hrbrthemes : Additional Themes and Theme Components for ‘ggplot2’

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


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:

Themes:

  • theme_ft_rc: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
  • theme_ipsum: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typography
  • theme_ipsum_ps: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
  • theme_ipsum_rc: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
  • theme_ipsum_tw: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy
  • theme_modern_rc: A precise & pristine ggplot2 theme with opinionated defaults and an emphasis on typoghraphy

Scales (that align with various themes):

  • scale_color_ft: Discrete color & fill scales based on the FT palette
  • scale_color_ipsum: Discrete color & fill scales based on the ipsum palette
  • scale_colour_ft: Discrete color & fill scales based on the FT palette
  • scale_colour_ipsum: Discrete color & fill scales based on the ipsum palette
  • scale_fill_ft: Discrete color & fill scales based on the FT palette
  • scale_fill_ipsum: Discrete color & fill scales based on the ipsum palette
  • scale_x_comma: X & Y scales with opinionated pre-sets for percent & comma label formats
  • scale_x_percent: X & Y scales with opinionated pre-sets for percent & comma label formats
  • scale_y_comma: X & Y scales with opinionated pre-sets for percent & comma label formats
  • scale_y_percent: X & Y scales with opinionated pre-sets for percent & comma label formats

Palettes/Named Colors:

  • ipsum_pal: A muted, qualitative color palette
  • ft_cols: FT color palette
  • ft_pal: A bright qualitative color palette
  • ft_text_col: FT color palette

Fonts:

  • font_an: Arial Narrow font name R variable aliases
  • font_ps: PlexSans font name R variable aliases
  • font_ps_light: PlexSans font name R variable aliases
  • font_rc: Roboto Condensed font name R variable aliases
  • font_rc_light: Roboto Condensed font name R variable aliases
  • font_tw: Titillium Web font name R variable aliases
  • font_tw_bold: Titillium Web font name R variable aliases
  • font_tw_light: Titillium Web font name R variable aliases

R Markdown:

  • ipsum: ipsum R markdown template
  • ipsum_pdf: ipsum R markdown template for PDF output

Utilities:

  • flush_ticks: Makes axis text labels flush on the ends
  • ft_geom_defaults: Change geom defaults from black to custom lights for the FT theme
  • gg_check: Spell check ggplot2 plot labels
  • import_plex_sans: Import IBM Plex Sans font for use in charts
  • import_roboto_condensed: Import Roboto Condensed font for use in charts
  • import_titillium_web: Import Titillium Web font for use in charts
  • modern_geom_defaults: Change geom defaults from black to white for the modern theme
  • update_geom_font_defaults: Update matching font defaults for text geoms

Installation

devtools::install_github("hrbrmstr/hrbrthemes")

Usage

library(hrbrthemes)
library(gcookbook)
library(tidyverse)

# current verison
packageVersion("hrbrthemes")
## [1] '0.6.0'

hrbrthemes Metrics

Lang # Files (%) LoC (%) Blank lines (%) # Lines (%)
R 20 0.91 1082 0.9 211 0.68 583 0.78
Rmd 2 0.09 124 0.1 99 0.32 162 0.22

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.