Skip to content

JLSteenwyk/ggpubfigs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
R
 
 
man
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Logo

follow on Twitter

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


Guide

Install
Quick Start
Color palettes
Themes
FAQ
Acknowledgements


Install

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

# 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


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

Currently, there are six color palettes to pick from.

friendly_pals

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

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

friendly_pals


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

friendly_pals



Themes

Publication-ready figures

theme_grid()

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

Grid


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

Grid


theme_big_grid()

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

Grid


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

Grid


theme_simple()

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

Simple


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

Simple


theme_big_simple()

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

Simple


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

Simple


theme_grey()

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

Grey


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

Grey


Presentation-ready figures

theme_black()

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

Black


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

Black


theme_blue()

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

Blue


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

Blue


theme_red()

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

Red


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 or from my contact information.


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 color palette package.

About

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

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

No packages published

Languages