目录
- 一、前言
- 二、官方教程
- 2.1 NPG
- 2.2 AAAS
- 2.3 NEJM
- 2.4 Lancet
- 2.5 JAMA
- 2.6 JCO
- 2.7 UCSCGB
- 2.8 d3
- 2.9 locuszoom
- 2.10 igv
- 2.11 uchicago
- 2.12 startrek
- 2.13 tron
- 2.14 futurama
- 2.15 rickandmorty
- 2.16 simpsons
- 2.17 gsea
- 2.18 material
- 三、讨论
一、前言
部分新手直接化用代码跑出来的图很多都是典型红蓝分组或者黄绿,可视化图第一目的是反馈数据信息,再者第二目的是让人看的明白看的舒服,ggsci很好的针对于可视化时的颜色问题。
这是ggsci包官网里面的一句话:
My eyes were finally opened and I understood nature.
I learned at the same time to love it.
— Claude Monet
二、官方教程
ggsci的调色板常用的来自于期刊,可视化数据库,电影电视节目等(并非全部都是期刊,上次一位学生逮着问辛普森是什么期刊)。每个调色板是有颜色可修改线框或填充颜色:
scale_color_palname()
scale_fill_palname()
Name | Scales | Palette Types | Palette Generator |
---|---|---|---|
NPG | scale_color_npg() scale_fill_npg() | “nrc” | pal_npg() |
AAAS | scale_color_aaas() scale_fill_aaas() | “default” | pal_aaas() |
NEJM | scale_color_nejm() scale_fill_nejm() | “default” | pal_nejm() |
Lancet | scale_color_lancet() scale_fill_lancet() | “lanonc” | pal_lancet() |
JAMA | scale_color_jama() scale_fill_jama() | “default” | pal_jama() |
JCO | scale_color_jco() scale_fill_jco() | “default” | pal_jco() |
UCSCGB | scale_color_ucscgb() scale_fill_ucscgb() | “default” | pal_ucscgb() |
D3 | scale_color_d3() scale_fill_d3() | “category10” “category20” “category20b” “category20c” | pal_d3() |
LocusZoom | scale_color_locuszoom() scale_fill_locuszoom() | “default” | pal_locuszoom() |
IGV | scale_color_igv() scale_fill_igv() | “default” “alternating” | pal_igv() |
UChicago | scale_color_uchicago() scale_fill_uchicago() | “default” “light” “dark” | pal_uchicago() |
Star Trek | scale_color_startrek() scale_fill_startrek() | “uniform” | pal_startrek() |
Tron Legacy | scale_color_tron() scale_fill_tron() | “legacy” | pal_tron() |
Futurama | scale_color_futurama() scale_fill_futurama() | “planetexpress” | pal_futurama() |
Rick and Morty | scale_color_rickandmorty() scale_fill_rickandmorty() | “schwifty” | pal_rickandmorty() |
The Simpsons | scale_color_simpsons() scale_fill_simpsons() | “springfield” | pal_simpsons() |
GSEA | scale_color_gsea() | scale_fill_gsea() “default” | pal_gsea() |
Material Design | scale_color_material() scale_fill_material() | “red” “pink” “purple” “deep-purple” “indigo” “blue” “light-blue” “cyan” “teal” “green” “light-green” “lime” “yellow” “amber” “orange” “deep-orange” “brown” “grey” “blue-grey” | pal_material() |
#展示颜色
install.packages("scales")
library("scales")
library("ggsci")
color= pal_npg("nrc")(10) #以npg为例,其他同理
show_col(color, labels = T, cex_label = 0.8, ncol = NULL)
2.1 NPG
(Nature Publishing Group)
color= pal_npg("nrc")(10)
2.2 AAAS
(American Association for the Advancement of Science)
color= pal_aaas("default")(10)
2.3 NEJM
(New England Journal of Medicine)
color= pal_nejm("default")(8)
2.4 Lancet
(柳叶刀)
color= pal_lancet("lanonc")(9)
2.5 JAMA
(The Journal of the American Medical Association)
color= pal_jama("default")(7)
2.6 JCO
(Journal of Clinical Oncology)
color= pal_jco("default")(10)
2.7 UCSCGB
(UCSC数据库)
color= pal_ucscgb("default")(26)
2.8 d3
(JavaScript绘图库D3.js色板)
color= pal_d3("category10")(10) #category20,category20b,category20c
2.9 locuszoom
(locuszoom网站)
color= pal_locuszoom("default")(7)
2.10 igv
(igv基因组染色体查看器)
color= pal_igv("default")(51)
color= pal_igv("alternating")(2)
2.11 uchicago
(芝加哥大学)
color= pal_uchicago("default")(9) #light,dark
2.12 startrek
(星际迷航)
color= pal_startrek("uniform")(7)
2.13 tron
(创战纪)
color= pal_tron("legacy")(7)
2.14 futurama
(futurama节目)
color= pal_futurama("planetexpress")(12)
2.15 rickandmorty
(rick and morty节目)
color= pal_rickandmorty("schwifty")(12)
2.16 simpsons
(辛普森一家)
color= pal_simpsons("springfield")(16)
2.17 gsea
(gsea常规配色)
color= pal_gsea("default")(12)
2.18 material
(单色板)
color= pal_material("red")(10) #单色,根据上述色更换即可
三、讨论
上述所有颜色直接使用即可,线框可正常调节粗细之类的。此外还可各自自由搭配,摆脱最原始的审美疲劳配色!
#调节透明度
show_col(pal_nejm("default", alpha = 0.6)(8))
show_col(pal_nejm("default", alpha = 0.9)(8))