1. R自带颜色
2. RColorBrewer
library(RColorBrewer)
?RColorBrewer
brewer.pal(n, name)
display.brewer.pal(n, name)
display.brewer.all(n=NULL, type="all", select=NULL, exact.n=TRUE,
colorblindFriendly=FALSE)
brewer.pal.info
Accent 8
Dark2 8
Paired 12
Pastel1 9
Pastel2 8
Set1 9
Set2 8
Set3 12
display.brewer.pal(11,"PiYG")
display.brewer.pal(4,"PiYG")
display.brewer.pal(9, "Set1")
display.brewer.pal(9, "Set2")
display.brewer.pal(11,"Pastel1")
display.brewer.pal(4,"Pastel2") display.brewer.pal(9, "Paired")
for example
mycols<-c(brewer.pal(9, "Paired"))
p <- DimPlot(sce, reduction = 'tsne', label = TRUE, pt.size = 0.5,raster=FALSE,cols=mycols)
p
3. ggsci
library("ggsci")
For all the color palettes, the corresponding scales are named as:
scale_color_palname()
scale_fill_palname()
1. NPG scale_color_npg() scale_fill_npg() "nrc" pal_npg()
2. AAAS scale_color_aaas() scale_fill_aaas() "default" pal_aaas()
3. NEJM scale_color_nejm() scale_fill_nejm() "default" pal_nejm()
4. Lancet scale_color_lancet() scale_fill_lancet() "lanonc" pal_lancet()
5. JAMA
JCO
UCSCGB
D3
LocusZoom
IGV
UChicago
Star Trek scale_color_startrek()
Tron Legacy scale_color_tron()
Futurama
Rick and Morty scale_color_rickandmorty()
The Simpsons scale_color_simpsons()
GSEA
Material Design scale_color_material()
for example
p <- DimPlot(sce, reduction = 'tsne', label = TRUE, pt.size = 0.5,raster=FALSE)
p +scale_color_npg()
4. 图片保存常用方法
library(ggpubr)
g<-ggexport(plotlist = list(a,p), filename = "clusters.pdf")