A selection of themes for ggplot2

A simple, clean collection of styles for your plots

I previously wrote an article about the importance of branding your charts and figures for your blog articles or social media posts. In my own work, I predominantly use the R package ggplot2. Even if it’s a quick plot that I’ve made in Excel, if I want to publish it somewhere or put it in a report, I’ll import the data into R and use ggplot2.

One of the great things about ggplot2 is the way plots can be customised. This customisation can be done at the level of each individual plot, at the level of adding a particular theme, with the + theme…() code, or a combination of the two.

Code for ggplot2 themes

I am in the process of creating my own library of custom themes for ggplot2, and the code can be found on GitHub. If there are any here that you want to use, feel free to grab the code and use at the end of your own ggplot2 calls. Many of themes themes grew from the excellent theme_tufte from jrnold’s ggthemes package, which is well worth install.packages -ing.

I’d be interested to hear if anyone is using them or if you have any comments, so feel free to give me a shout on Twitter.

As I make new themes, I will commit the code to GitHub and post an example image here, so keep an eye out for the new content.

The ggplot2 custom themes

Example posts have been produced using the Iris dataset and the following code:

ggplot(iris, aes(Sepal.Length, Sepal.Width,
colour = Species)) +
geom_point() +
labs(title = "Sepal Width Against Sepal Length",
subtitle = "By species",
x = "Sepal length",
y = "Sepal width",
caption = "Data from 'Iris' dataset") +
theme...()

Default ggplot2 plot

theme_minimal_serif_navy()

theme_minimal_axes_serif_navy()

theme_grid_serif_navy()

theme_panel_parchment_light()

theme_panel_parchment()

theme_panel_hookem()

theme_panel_blue()

I believe I have read some mention of more formatting options (such as colour schemes)

In the meantime, I hope these humble themes might be of some use! Happy R and and happy plotting!