写在前面
今天在Nature Plant
(IF:16.0)期刊中看到文中的图形,进一步的查看后发现作者使用一个R包来进行图形颜色的搭配。就此机会也分享给大家,若你需要可以进一步查看及使用此包。
对于图形颜色的搭配,对于文章整体美观
是非常重要。但是,我相信很多人对于自己的文章图形颜色搭配也是一个头疼的问题,包括自己。每次绘图时,总是在纠结自己整体图形颜色的搭配。若,我们仔细查看顶刊期刊的文章,他们的图形颜色搭配真舒服
。有时候,真的应了那句话:顶刊就是顶刊,毋庸置疑。
文章网址
https://doi.org/10.1038/s41477-023-01513-x
正文Figure欣赏
使用calecopal包
R包网址:
https://github.com/an-bui/calecopal
安装
devtools::install_github("an-bui/calecopal")
可选颜色
颜色色彩搭配灵感来源
使用
library(calecopal)
# all palettes
names(cal_palettes)
创建Building palettes
cal_palette(name = "desert", n = 15, type = "continuous")
cal_palette("sierra1", n = 50, type = "continuous")
提供事例
library(tidyverse)
ggplot(chickwts %>%
group_by(feed) %>%
summarize(av = mean(weight),
total = length(weight)) %>%
filter(feed != "casein"),
aes(x = feed, y = av, fill = feed)) +
geom_col() +
scale_fill_manual(values = cal_palette("sierra1")) + ## 添加对应的颜色即可
theme_bw()
ggplot(chickwts, aes(x = feed, y = weight, color = feed)) +
geom_jitter(aes(color = feed), alpha = 0.8, width = 0.3, size = 2) +
geom_boxplot(alpha = 0.2) +
scale_color_manual(values = cal_palette("kelp1")) +
theme_bw()
calecopal包颜色搭配
搭配模式选项
Complete list of palettes
"sierra1" "sierra2" "chaparral1" "chaparral2" "chaparral3"
"conifer" "desert" "wetland" "oak" "kelp1"
"kelp2" "coastaldune1" "coastaldune2" "superbloom1" "superbloom2"
"superbloom3" "sbchannel" "lake" "fire" "agriculture"
"bigsur" "figmtn" "caqu" "ceschscholzia""arbutus"
"calochortus" "grassdry" "grasswet" "sage" "tidepool"
"seagrass" "bigsur2" "bixby" "redwood1" "redwood2"
"halfdome" "creek" "vermillion" "canary" "casj"
"lupinus" "dudleya" "gayophytum" "collinsia" "buow"
颜色选择
cal_palettes <- list(
### release 1: June 2020
sierra1 = c("#BD973D", "#5F5C29", "#3B7D6E", "#5792CC", "#4D5B75", "#262E43"),
sierra2 = c("#FDD989", "#8BAD57", "#516238", "#4CA2B0", "#5A8B92", "#395B5F"),
chaparral1 = c("#DCC27A", "#B0B9BE", "#63605F", "#985E5C", "#AEBFA8", "#F19B34"),
chaparral2 = c("#D98A63", "#D9E4DC", "#C5D2D2", "#79B38F", "#9A9B5F", "#A7C2CD"),
chaparral3 = c("#D3E3CA", "#BED6B3", "#92A587", "#4A5438", "#2F3525"),
conifer = c("#CC7540", "#765043", "#A69260", "#979A6B", "#39692F"),
desert = c("#F6EECF", "#ECD6AB", "#B09175", "#632D1F", "#291611"),
wetland = c("#DED4C8", "#AD6F4F", "#AEC96F", "#2B3851", "#3F320D"),
oak = c("#EFC68E", "#B58755", "#7C9867", "#4F5730","#7A5028"),
kelp1 = c("#C70000", "#FFBF00", "#BE8333", "#54662C", "#009BB0", "#114C54"),
kelp2 = c("#0FB2D3", "#026779", "#368000", "#3D6334", "#6D5A18"),
coastaldune1 = c("#DCC8BA", "#DCD6C5", "#B4AA98", "#D7DCE4", "#444239"),
coastaldune2 = c("#E2D78A", "#E4B3E2", "#90816E", "#523833", "#372E21"),
superbloom1 = c("#B9C7E2", "#ECAB99", "#F1C100", "#5B6530", "#9484B1"),
superbloom2 = c("#DE7424", "#F5CA37", "#AD8D26", "#496849", "#654783"),
superbloom3 = c("#E69512", "#D3105C", "#3B4F8E", "#3A5D3D", "#4C4976", "#6C91BD"),
sbchannel = c("#A1CAF6", "#6592D6", "#4C6FA1", "#375377", "#1E2F46"),
lake = c("#CECEB9", "#7AC9B7", "#6CA184", "#3793EC", "#2A3927"),
fire = c("#B77B7B", "#FEEC44", "#F66C09", "#E60505", "#2C1B21"),
agriculture = c("#A45C44", "#5A7F3C", "#CACA91", "#2C3B26", "#88B063"),
bigsur = c("#E4DECE", "#ECBD95", "#9BB1BB", "#79ACBD", "#346575", "#0B4221"),
figmtn = c("#E29244", "#FFAA00", "#D46F10", "#4CA49E", "#69B9FA", "#59A3F8", "#4B8FF7", "#5A7ECB", "#6B6D9F"),
### release 2: Sep 2020
caqu = c("#E6DECC", "#F3E3C2", "#8F96A6", "#625D55", "#501F16"), # california quail
eschscholzia = c("#F2B705", "#F29F05", "#F28705", "#D95204", "#A62F03"), # california poppy
arbutus = c("#DFE3CE", "#B5C861", "#8AA789", "#CB8573", "#976153"), # pacific madrone
calochortus = c("#CAC8CF", "#C9B3B5", "#8F706E", "#AF6E78", "#5C3327"), # catalinae
grassdry = c("#E1BC8D", "#845B3E", "#5B4E23", "#35301C", "#4C5454"),
grasswet = c("#4C4E32","#908E6C","#5D8FBC","#97C2E2","#17252A","#B4A480"),
sage = c("#607860", "#304830", "#C0D8F0", "#909078", "#181818"),
tidepool = c("#84A6A2","#4A5352","#151E2F","#D7C8C6","#BE5A47","#604A76"),
seagrass = c("#5A870A", "#BDD0A2", "#555B53", "#6A4D3B", "#BEAB91", "#8F9BAB"),
bigsur2 = c("#20618D", "#91AAC4", "#6B6C58", "#464724", "#83932D", "#CAB89F"),
bixby = c("#286A81", "#045CB4", "#7F6F43", "#748B75", "#B8B196"),
redwood1 = c("#303018", "#604830", "#609048", "#90A860", "#786048"),
redwood2 = c("#304818", "#906030", "#486030", "#784830", "#181800"),
halfdome = c("#A2A098", "#5E6B7B", "#233D3F", "#85ADCC", "#426714"),
creek = c("#EBDAC9", "#CEAD96", "#CECFD4", "#686F60", "#455D44", "#23341E"),
vermillion = c("#c39ca4","#e05959","#ac181d","#713d3f","#381f21"), # vermillion rockfish
canary = c("#FFDBA5", "#FAB455", "#F28023", "#A5683C", "#B4450E"), # canary rockfish
casj = c("#336887", "#8197A4", "#A9B4BC", "#B7AA9F", "#706A6B"),
lupinus = c("#6C568C", "#9386A6", "#BFCDD9", "#7F8C72", "#607345"),
dudleya = c("#7E8C69", "#E7A655", "#E59D7F", "#E38377", "#6D4847"),
gayophytum = c("#AA767C", "#B7AF57", "#797014", "#C2607F", "#A65644"),
collinsia = c("#9E8ABC", "#A99CD9", "#808C91", "#A7907B", "#A5BA92"),
buow = c("#DED4CB", "#DBE38E", "#7E7576", "#A79787", "#3A2C21") # burrowing owl
)
已发表的文章图形鉴赏
文章图形颜色的搭配方案很多,也是我们作图所必备的“审美技能”之一。
往期文章:
1. 复现SCI文章系列专栏
2. 《生信知识库》,同步更新,易与搜索与管理。
3. 最全WGCNA教程(替换数据即可出全部结果与图形)
4. 精美图形绘制教程
5. 转录组分析教程
小杜的生信筆記,主要发表或收录生物信息学的教程,以及基于R的分析和可视化(包括数据分析,图形绘制等);分享感兴趣的文献和学习资料!!