18.4 ggsci
Package {ggsci} contains a collection of pre-made color palettes inspired by colors used in scientific journals (and also by Science Fiction movies and series!).
Example of palettes from {ggsci}:
- scale_color_npg() and scale_fill_npg() (Nature Publishing Group)
- scale_color_aaas() and scale_fill_aaas(): (American Association for the Advancement of Science)
- scale_color_lancet() and scale_fill_lancet() (Lancet)
- scale_color_igv() and scale_fill_igv() (Integrative Genome Viewer)
- scale_color_gsea() and scale_fill_gsea() (Gene Set Enrichment Analysis)
- scale_color_startrek() and scale_fill_startrek()
- scale_color_simpsons() and scale_fill_simpsons()
Note that some palettes are for continuous variables (e.g. gsea), and some for discrete variables (e.g. npg).
Example of scales for discrete data:
# do not forget to load the package!
library(ggsci)
ggplot(data=gtf, mapping=aes(x=chr, fill=gene_type)) +
geom_bar(position="dodge") +
ggtitle("scale_fill_ngp", subtitle = "Nature Publishing Group") +
scale_fill_npg()
ggplot(data=gtf, mapping=aes(x=chr, fill=gene_type)) +
geom_bar(position="dodge") +
ggtitle("scale_fill_aaas", subtitle = "American Association for the Advancement of Science") +
scale_fill_aaas()
Example of a scale for continuous data:
