An open API service indexing awesome lists of open source software.

https://github.com/jlsteenwyk/ggpubfigs

colorblind friendly color palettes and ggplot2 graphic system extensions for publication-quality scientific figures
https://github.com/jlsteenwyk/ggpubfigs

colorblind-friendly figure figure-maker ggplot ggplot-extension ggplot2 r

Last synced: over 1 year ago
JSON representation

colorblind friendly color palettes and ggplot2 graphic system extensions for publication-quality scientific figures

Awesome Lists containing this project

README

          


Logo
















**ggpubfigs** is a ggplot2 extension that helps create publication ready figures for the life sciences.

Importantly, ggpubfigs implements themes and color palettes that are both aesthetically pleasing and colorblind friendly.


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](https://jlsteenwyk.com/publication_pdfs/2021_Steenwyk_and_Rokas_Microbiology_Resource_Announcements.pdf)


---

## Guide
[Install](#install)

[Quick Start](#quick-start)

[Color palettes](#color-palettes)

[Table of Hex Codes](#table-of-hex-codes)

[Themes](#themes)

[FAQ](#faq)

[Acknowledgements](#acknowledgements)


---
## Install
```R
# execute this command only the first time you use ggpubfigs
devtools::install_github("JLSteenwyk/ggpubfigs")
# load ggpubfigs
library(ggpubfigs)
```

---
## Quick Start
These *quick start* examples demonstrate how to implement two aesthetically pleasing themes and color palettes.

```R
# 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()
```


ito_simple



```R
# 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()
```


bright_grid



---
## 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.


Color palettes are named using the following scheme: *identifier* (underscore) *number of colors in color palette*.

friendly_pals

To use these colorblind friendly color palettes, use the following command as an example for both discrete and continuous purposes:

```R
ggplot(mtcars, aes(factor(carb), fill=factor(cyl))) + geom_bar() + scale_fill_manual(values = friendly_pal("contrast_three"))
```


friendly_pals



```R
pal <- friendly_pal("contrast_three", 50, type = "continuous")
image(volcano, col = pal)
```


friendly_pals



---
## Table of Hex Codes
| Palettes | 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 |


---
## Themes
### Publication-ready figures
**theme_grid()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_grid()
```


Grid



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_grid()
```


Grid



**theme_big_grid()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_big_grid()
```


Grid



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_big_grid()
```


Grid



**theme_simple()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_simple()
```


Simple



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_simple()
```


Simple



**theme_big_simple()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_big_simple()
```


Simple



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_big_simple()
```


Simple



**theme_grey()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_grey()
```


Grey



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_grey()
```


Grey



### Presentation-ready figures
**theme_black()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_black()
```


Black



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_black()
```


Black



**theme_blue()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_blue()
```


Blue



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_blue()
```


Blue



**theme_red()**

```R
ggplot(iris, aes(Sepal.Length, Petal.Width, color = Species)) + geom_point() + theme_red()
```


Red



```R
ggplot(iris, aes(Sepal.Length, fill = Species)) + geom_histogram() + theme_red()
```


Red


---
## FAQ
**Can I submit color palettes or themes to be incorporated into ggpubfigs?**

Yes! Submissions are encouraged, please feel free to contact me via [twitter](https://twitter.com/jlsteenwyk) or from my [contact information](https://jlsteenwyk.com/contact.html).


---
## Acknowledgements
I would like to thank the blooming R community for all the very helpful online forums, discussions, and open source books that have helped me learn R.


I would also like to acknowledge that some of the example usage and color palette code was developed based on open source code from the [wes anderson](https://github.com/karthik/wesanderson) color palette package.