Additional Themes, Theme Components and Utilities for 'ggplot2'

A compilation of extra 'ggplot2' themes, scales and utilities, including a spell check function for plot label fields and an overall emphasis on typography. A copy of the 'Google' font 'Roboto Condensed' <> is also included along with a copy of the 'IBM' 'Plex Sans' <>, 'Titillium Web' <>, and 'Public Sans' <> fonts are also included to support their respective typography-oriented themes.

Project Status: Active - The project has reached a stable, usable state and is being actively developed. codecov Travis-CI Build Status

hrbrthemes : Additional Themes and Theme Components for 'ggplot2'

This is a very focused package that provides typography-centric themes and theme components for ggplot2. It's a an extract/riff of hrbrmisc created by request.

The core theme: theme_ipsum ("ipsum" is Latin for "precise") uses Arial Narrow which should be installed on practically any modern system, so it's "free"-ish. This font is condensed, has solid default kerning pairs and geometric numbers. That's what I consider the "font trifecta" must-have for charts. An additional quality for fonts for charts is that they have a diversity of weights. Arial Narrow (the one on most systems, anyway) does not have said diversity but this quality is not (IMO) a "must have".

The following functions are implemented/objects are exported:

  • theme_ipsum : Arial Narrow-based theme
  • theme_ipsum_rc : Roboto Condensed-based theme
  • gg_check: Spell check ggplot2 plot labels
  • update_geom_font_defaults: Update matching font defaults for text geoms (the default is — unsurprisingly — Arial Narrow)
  • scale_x_comma / scale_y_comma : Comma format for axis text and expand=c(0,0) (you need to set limits)
  • scale_x_percent / scale_y_percent : Percent format for axis text and expand=c(0,0) (you need to set limits)
  • scale_color_ipsum / scale_fill_ipsum / ipsum_pal : A muted discrete color palette with 9 colors
  • font_an: a short global alias for "Arial Narrow"
  • font_rc: a short global alias for "Roboto Condensed"
  • font_rc_light: a short global alias for "Roboto Condensed Light"


# current verison
## [1] '0.1.0'

Base theme (Arial Narrow)

ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(x="Fuel effiiency (mpg)", y="Weight (tons)",
       title="Seminal ggplot2 scatterplot example",
       subtitle="A plot that is only useful for demonstration purposes",
       caption="Brought to you by the letter 'g'") + 

Roboto Condensed

ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(x="Fuel effiiency (mpg)", y="Weight (tons)",
       title="Seminal ggplot2 scatterplot example",
       subtitle="A plot that is only useful for demonstration purposes",
       caption="Brought to you by the letter 'g'") + 

Scales (Color/Fill)

ggplot(mtcars, aes(mpg, wt)) +
  geom_point(aes(color=factor(carb))) +
  labs(x="Fuel effiiency (mpg)", y="Weight (tons)",
       title="Seminal ggplot2 scatterplot example",
       subtitle="A plot that is only useful for demonstration purposes",
       caption="Brought to you by the letter 'g'") + 
  scale_color_ipsum() +

Scales (Axis)

count(mpg, class) %>% 
  mutate(pct=n/sum(n)) %>% 
  ggplot(aes(class, pct)) +
  geom_col() +
  scale_y_percent() +
  labs(x="Fuel effiiency (mpg)", y="Weight (tons)",
       title="Seminal ggplot2 column chart example with percents",
       subtitle="A plot that is only useful for demonstration purposes",
       caption="Brought to you by the letter 'g'") + 
ggplot(uspopage, aes(x=Year, y=Thousands, fill=AgeGroup)) + 
  geom_area() +
  scale_fill_ipsum() +
  scale_x_continuous(expand=c(0,0)) +
  scale_y_comma() +
  labs(title="Age distribution of population in the U.S., 1900-2002",
       subtitle="Example data from the R Graphics Cookbook",
       caption="Source: R Graphics Cookbook") +
  theme_ipsum_rc(grid="XY") +
  theme(axis.text.x=element_text(hjust=c(0, 0.5, 0.5, 0.5, 1))) +
count(mpg, class) %>% 
  mutate(n=n*2000) %>% 
  arrange(n) %>% 
  mutate(class=factor(class, levels=class)) %>% 
  ggplot(aes(class, n)) +
  geom_col() +
  geom_text(aes(label=scales::comma(n)), hjust=0, nudge_y=2000) +
  scale_y_comma(limits=c(0,150000)) +
  coord_flip() +
  labs(x="Fuel effiiency (mpg)", y="Weight (tons)",
       title="Seminal ggplot2 column chart example with commas",
       subtitle="A plot that is only useful for demonstration purposes, esp since you'd never\nreally want direct labels and axis labels",
       caption="Brought to you by the letter 'g'") + 

Spellcheck ggplot2 labels

df <- data.frame(x=c(20, 25, 30), y=c(4, 4, 4), txt=c("One", "Two", "Three"))
ggplot(mtcars, aes(mpg, wt)) +
  geom_point() +
  labs(x="This is some txt", y="This is more text",
       title="Thisy is a titlle",
       subtitle="This is a subtitley",
       caption="This is a captien") +
  theme_ipsum_rc(grid="XY") -> gg
## Possible misspelled words in [title]: (Thisy, titlle)
## Possible misspelled words in [subtitle]: (subtitley)
## Possible misspelled words in [caption]: (captien)

Test Results

## [1] "Sat Feb 25 11:57:34 2017"
## testthat results ========================================================================================================
## OK: 10 SKIPPED: 0 FAILED: 0
## DONE ===================================================================================================================

Code of Conduct

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


hrbrthemes 0.5.0

New Stuff

  • flush_ticks() for easier alignment of x/y axis labels
  • ipsum_pdf R Markdown format for using hrbrthemes in PDFs
  • theme_ipsum_tw() (+ fonts) a Titillium Web-based theme

hrbrthemes 0.3.2

New Stuff

  • IBM Plex Sans font + theme
  • New "dark" RC theme mostly for RStudio plotting

Changed Stuff

  • Removed purrr dependency
  • Tweaked scale_s with expand=c(0.01,0)
  • Secondary axis support (by Dan Wilson)
  • Updated tests

hrbrthemes 0.2.0

Changed Stuff

  • Added vdiffr tests for the two core themes.
  • Moved hunspell and stringi to Suggests and added namespace tests to gg_check().
  • Added dict and ignore parameters (with defaults) to gg_check() (@karldw) [PR #3].
  • Fixed typos (@benmarwick) [PR #1].
  • Spelling in vignette fixed (@zx8754) [Issue #6].
  • New lighter grid color default #cccccc [Issue #7].
  • Added font auto-loading (@alexwhan) [Issue #12].
  • Made base font 0.5 pts larger

hrbrthemes 0.1.0

New Stuff

  • Initial release with 'Roboto Condensed' and 'Arial Narrow' fonts based 'ggplot2' themes.
  • Muted discrete color palette with 9 colors.
  • 'ggplot2' scales for percentage and comma.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.8.0 by Bob Rudis, 2 years ago

Report a bug at

Browse source code at

Authors: Bob Rudis [aut, cre] , Patrick Kennedy [ctb] , Philipp Reiner [ctb] , Dan Wilson [ctb] (Secondary axis support) , Xavier Adam [ctb] , Google [cph] (Roboto Condensed & Titillium Web Fonts) , IBM [cph] (Plex Sans Font) , Impallari Type [cph] (Public Sans Font) , Jacob Barnett [ctb] , Thomas J. Leeper [ctb] , Joris Meys [ctb]

Documentation:   PDF Manual  

MIT + file LICENSE license

Imports ggplot2, grDevices, grid, scales, extrafont, knitr, rmarkdown, htmltools, tools, magrittr, gdtools

Suggests testthat, dplyr, gridExtra, hunspell, stringi, gcookbook, clipr, vdiffr, svglite

Imported by dlookr, fontHind, fontMPlus, mdthemes, zGPS.AO.

Depended on by gamblers.ruin.gameplay.

Suggested by CGPfunctions, causalCmprsk, esquisse, umx.

See at CRAN