如何快速使用SCI期刊的配色——ggsci简介
Posted 统计学小王子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了如何快速使用SCI期刊的配色——ggsci简介相关的知识,希望对你有一定的参考价值。
目录
0引言
相比于基础包中的画图思路和风格,ggplot2在R语言中被很多使用者广泛应用。本文介绍一个基于ggplot2开发的包ggsci。这个包里有一些期刊的配色风格,可以直接通过**+**使用。下面是具体的介绍
1、安装
install.packages("ggsci")
2、载入
library("ggsci")
3、主要函数
> ls("package:ggsci")
[1] "pal_aaas" "pal_d3"
[3] "pal_futurama" "pal_gsea"
[5] "pal_igv" "pal_jama"
[7] "pal_jco" "pal_lancet"
[9] "pal_locuszoom" "pal_material"
[11] "pal_nejm" "pal_npg"
[13] "pal_rickandmorty" "pal_simpsons"
[15] "pal_startrek" "pal_tron"
[17] "pal_uchicago" "pal_ucscgb"
[19] "rgb_gsea" "rgb_material"
[21] "scale_color_aaas" "scale_color_d3"
[23] "scale_color_futurama" "scale_color_gsea"
[25] "scale_color_igv" "scale_color_jama"
[27] "scale_color_jco" "scale_color_lancet"
[29] "scale_color_locuszoom" "scale_color_material"
[31] "scale_color_nejm" "scale_color_npg"
[33] "scale_color_rickandmorty" "scale_color_simpsons"
[35] "scale_color_startrek" "scale_color_tron"
[37] "scale_color_uchicago" "scale_color_ucscgb"
[39] "scale_colour_aaas" "scale_colour_d3"
[41] "scale_colour_futurama" "scale_colour_gsea"
[43] "scale_colour_igv" "scale_colour_jama"
[45] "scale_colour_jco" "scale_colour_lancet"
[47] "scale_colour_locuszoom" "scale_colour_material"
[49] "scale_colour_nejm" "scale_colour_npg"
[51] "scale_colour_rickandmorty" "scale_colour_simpsons"
[53] "scale_colour_startrek" "scale_colour_tron"
[55] "scale_colour_uchicago" "scale_colour_ucscgb"
[57] "scale_fill_aaas" "scale_fill_d3"
[59] "scale_fill_futurama" "scale_fill_gsea"
[61] "scale_fill_igv" "scale_fill_jama"
[63] "scale_fill_jco" "scale_fill_lancet"
[65] "scale_fill_locuszoom" "scale_fill_material"
[67] "scale_fill_nejm" "scale_fill_npg"
[69] "scale_fill_rickandmorty" "scale_fill_simpsons"
[71] "scale_fill_startrek" "scale_fill_tron"
[73] "scale_fill_uchicago" "scale_fill_ucscgb"
4、实例(配色)
4.1基本图
library('patchwork')
p1 <- ggplot(iris, aes(Sepal.Length, Sepal.Width, colour = Species)) +
geom_point(alpha = 0.4, position = "jitter") +
geom_smooth(method = "loess", span = 0.9, se = FALSE, alpha = 0.05)
4.2 加主题
p2 <- p1 + theme_bw() +
theme(legend.position = "top")
4.3 改配色
p3 <- p2 + scale_colour_jama() + scale_fill_jama()
4.4 展示
p1 + p2 + p3
以上是关于如何快速使用SCI期刊的配色——ggsci简介的主要内容,如果未能解决你的问题,请参考以下文章