這些顏色來自于網(wǎng)頁(yè)鏈接 https://www.royfrancis.com/elegant-scientific-graphs-learning-from-examples/,我使用snipaste軟件把顏色弄下來了凛辣,記錄一下抱既,自己備用,也分享給大家
三個(gè)顏色
library(ggplot2)
colors_1<-c("#e20612","#ffd401","#00b0eb")
df1<-data.frame(x=letters[1:3],y=1:3)
library(ggplot2)
ggplot(data=df1,aes(x,y))+
geom_col(aes(fill=x))+
theme_bw()+
scale_fill_manual(values = colors_1)+
geom_label(aes(label=colors_1))+
scale_y_continuous(expand = c(0,0),
limits = c(0,4))
5個(gè)顏色
colors_3<-c("#ef1828","#f88421","#ffbc14",
"#00bdcd","#006b7b")
df3<-data.frame(x=letters[1:5],
y=1:5)
ggplot(data=df3,aes(x,y))+
geom_col(aes(fill=x))+
theme_bw()+
scale_fill_manual(values = colors_3)+
geom_label(aes(label=colors_3))+
scale_y_continuous(expand = c(0,0),
limits = c(0,6))+
theme(legend.position = "none")
8個(gè)顏色
colors_2<-c("#cc340c","#e8490f","#f18800","#e4ce00",
"#9ec417","#13a983","#44c1f0","#3f60aa")
df2<-data.frame(x=letters[1:8],
y=1:8)
ggplot(data=df2,aes(x,y))+
geom_col(aes(fill=x))+
theme_bw()+
scale_fill_manual(values = colors_2)+
geom_label(aes(label=colors_2))+
scale_y_continuous(expand = c(0,0),
limits = c(0,9))+
theme(legend.position = "none")
兩個(gè)顏色
colors_4<-c("#156077","#f46f20")
df4<-data.frame(x=letters[1:2],
y=1:2)
ggplot(data=df4,aes(x,y))+
geom_col(aes(fill=x))+
theme_bw()+
scale_fill_manual(values = colors_4)+
geom_label(aes(label=colors_4))+
scale_y_continuous(expand = c(0,0),
limits = c(0,3))+
theme(legend.position = "none")
colors_5<-c("#4da0a0","#9b3a74")
ggplot(data=df4,aes(x,y))+
geom_col(aes(fill=x))+
theme_bw()+
scale_fill_manual(values = colors_5)+
geom_label(aes(label=colors_5))+
scale_y_continuous(expand = c(0,0),
limits = c(0,3))+
theme(legend.position = "none")
6個(gè)顏色
colors_6<-c("#3cb346","#00abf0","#d75427",
"#2e409a","#942d8d","#eeb401")
df6<-data.frame(x=letters[1:6],
y=1:6)
ggplot(data=df6,aes(x,y))+
geom_col(aes(fill=x))+
theme_bw()+
scale_fill_manual(values = colors_6)+
geom_label(aes(label=colors_6))+
scale_y_continuous(expand = c(0,0),
limits = c(0,6))+
theme(legend.position = "none")
這個(gè)鏈接里還有其他的顏色扁誓,大家也可以挑選自己喜歡的顏色防泵,直接用snipaste這個(gè)軟件來獲取顏色值
歡迎大家關(guān)注我的公眾號(hào)
小明的數(shù)據(jù)分析筆記本
小明的數(shù)據(jù)分析筆記本 公眾號(hào) 主要分享:1、R語(yǔ)言和python做數(shù)據(jù)分析和數(shù)據(jù)可視化的簡(jiǎn)單小例子蝗敢;2捷泞、園藝植物相關(guān)轉(zhuǎn)錄組學(xué)、基因組學(xué)寿谴、群體遺傳學(xué)文獻(xiàn)閱讀筆記锁右;3、生物信息學(xué)入門學(xué)習(xí)資料及自己的學(xué)習(xí)筆記!