ggsci
ggsci offers a collection of high-quality color palettes inspired by colors used in scientific journals, data visualization libraries, science fiction movies, and TV shows. The color palettes in ggsci are available as ggplot2 scales. For all the color palettes, the corresponding scales are named as:
-scale_color_palname()
-scale_fill_palname()
包括以下多种期刊颜色选择:
其他颜色主题可以见官网介绍。
ggthemes
ggsci定义的是颜色,ggthemes则是直接定义好主题。
RColorBrewer
# 调出所有颜色
library(RColorBrewer)
display.brewer.all()
1,seq类型:单渐变色,一种主色由浅到深
2,qual类型:区分色,几种区分度很高的颜色组合(我最常用~)
3,div类型:双渐变色,一种颜色到另外一种颜色的渐变,有两种主色
# 文字描述了解每种配色的具体信息
> brewer.pal.info
> maxcolors category colorblind
BrBG 11 div TRUE
PiYG 11 div TRUE
PRGn 11 div TRUE
PuOr 11 div TRUE
RdBu 11 div TRUE
RdGy 11 div FALSE
RdYlBu 11 div TRUE
RdYlGn 11 div FALSE
Spectral 11 div FALSE
Accent 8 qual FALSE
Dark2 8 qual TRUE
Paired 12 qual TRUE
Pastel1 9 qual FALSE
Pastel2 8 qual FALSE
Set1 9 qual FALSE
Set2 8 qual TRUE
Set3 12 qual FALSE
Blues 9 seq TRUE
BuGn 9 seq TRUE
BuPu 9 seq TRUE
GnBu 9 seq TRUE
Greens 9 seq TRUE
Greys 9 seq TRUE
Oranges 9 seq TRUE
OrRd 9 seq TRUE
PuBu 9 seq TRUE
PuBuGn 9 seq TRUE
PuRd 9 seq TRUE
Purples 9 seq TRUE
RdPu 9 seq TRUE
Reds 9 seq TRUE
YlGn 9 seq TRUE
YlGnBu 9 seq TRUE
YlOrBr 9 seq TRUE
YlOrRd 9 seq TRUE
# 具体配色详细信息
display.brewer.pal(9,'Set1')
brewer.pal(9,"Set1")
"#E41A1C" "#377EB8" "#4DAF4A" "#984EA3" "#FF7F00" "#FFFF33" "#A65628" "#F781BF" "#999999"
看到这里感觉这个包其实原理很简单,是不是我也可以自己做一个?