Ggpubfigs
colorblind friendly color palettes and ggplot2 graphic system extensions for publication-quality scientific figures
Install / Use
/learn @JLSteenwyk/GgpubfigsREADME
ggpubfigs is a ggplot2 extension that helps create publication ready figures for the life sciences.<br /> Importantly, ggpubfigs implements themes and color palettes that are both aesthetically pleasing and colorblind friendly. <br /><br />
If you found ggpubfigs helpful, please cite: ggpubfigs: Colorblind-Friendly Color Palettes and ggplot2 Graphic System Extensions for Publication-Quality Scientific Figures. DOI: 10.1128/MRA.00871-21 <br /><br />
Guide
Install<br /> Quick Start<br /> Color palettes<br /> Palette Swatches and Hex Codes<br /> Themes<br /> FAQ<br /> Change Log<br /> Versioning<br /> Acknowledgements <br /><br />
Install
# execute this command only the first time you use ggpubfigs
devtools::install_github("JLSteenwyk/ggpubfigs")
# load ggpubfigs
library(ggpubfigs)
<br />
Quick Start
These quick start examples demonstrate how to implement two aesthetically pleasing themes and color palettes.
# using the "ito_seven" color palette and theme_big_simple()
ggplot(mtcars, aes(factor(carb), fill=factor(cyl))) + geom_bar() + scale_fill_manual(values = friendly_pal("ito_seven")) + theme_big_simple()
<p align="center">
<img src="https://github.com/JLSteenwyk/ggpubfigs/blob/master/master/docs/_static/ito_big_simple.png" alt="ito_simple" width="400">
</p>
<br />
# using the "bright_seven" color palette and theme_big_grid()
ggplot(mtcars, aes(factor(carb), fill=factor(cyl))) + geom_bar() + scale_fill_manual(values = friendly_pal("bright_seven")) + theme_big_grid()
<p align="center">
<img src="https://github.com/JLSteenwyk/ggpubfigs/blob/master/master/docs/_static/bright_big_grid.png" alt="bright_grid" width="400">
</p>
<br />
Color palettes
Color palettes are all colorblind friendly. Thus, your figures will be accessible to more people, which is inarguably better for your audience and you. <br /><br /> Color palettes are named using the following scheme: identifier (underscore) number of colors in color palette.<br /> Palette swatches and hex codes are shown below for quick visual comparison.<br />
To use these colorblind friendly color palettes, use the following command as an example for both discrete and continuous purposes:<br />
ggplot(mtcars, aes(factor(carb), fill=factor(cyl))) + geom_bar() + scale_fill_manual(values = friendly_pal("contrast_three"))
<p align="center">
<img src="https://github.com/JLSteenwyk/ggpubfigs/blob/master/master/docs/_static/contrast_three.png" alt="friendly_pals" width="400">
</p>
<br />
pal <- friendly_pal("contrast_three", 50, type = "continuous")
image(volcano, col = pal)
<p align="center">
<img src="https://github.com/JLSteenwyk/ggpubfigs/blob/master/master/docs/_static/contrast_three_volcano.png" alt="friendly_pals" width="400">
</p>
<br />
Palette Swatches and Hex Codes
| Palette | Swatches | Colors used |
| -------------- | ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| bright_seven |
| #4477AA, #228833, #AA3377, #BBBBBB, #66CCEE, #CCBB44, #EE6677 |
| contrast_three |
| #004488, #BB5566, #DDAA33 |
| vibrant_seven |
| #0077BB, #EE7733, #33BBEE, #CC3311, #009988, #EE3377, #BBBBBB |
| muted_nine |
| #332288, #117733, #CC6677, #88CCEE, #999933, #882255, #44AA99, #DDCC77, #AA4499 |
| nickel_five |
| #648FFF, #FE6100, #785EF0, #FFB000, #DC267F |
| ito_seven |
| #0072B2, #D55E00, #009E73, #CC79A7, #56B4E9, #E69F00, #F0E442 |
| ibm_five |
| #648FFF, #785EF0, #DC267F, #FE6100, #FFB000 |
| wong_eight |
| #E69F00, #56B4E9, #009E73, #F0E442, #0072B2, #D55E00, #CC79A7, #000000 |
| tol_eight |
| #332288, #117733, #44AA99, #88CCEE, #DDCC77, #CC6677, #AA4499, #882255 |
| zesty_four |
| #F5793A, #A95AA1, #85C0F9, #0F2080 |
| retro_four |
| #601A4A, #EE442F, #63ACBE, #F9F4EC |
| tableau_ten |
| #4E79A7, #F28E2B, #E15759, #76B7B2, #59A14F, #EDC948, #B07AA1, #FF9DA7, #9C755F, #BAB0AC |
| glasbey_twelve |
| #0000FF, #FF0000, #00FF00, #000033, #FF00B6, #005300, #FFD300, #009FFF, #9A4D42, #00FFBE, #783FC1, #1F9698 |
| viridis_eight |
| #440154, #46337E, #365C8D, #277F8E, #1FA187, #4AC16D, #9FDA3A, #FDE725 |
|
