Skip to contents

Edit the ggplot2::theme() settings to use Populace branding guidelines

Usage

theme_populace(
  base_size = 30,
  transparent = FALSE,
  title_textbox = TRUE,
  title_position = c("plot", "panel"),
  x_grid = TRUE,
  y_grid = TRUE,
  axis_text_size = base_size * 0.5,
  axis_title_size = base_size * 0.7,
  facet_strip_bg = NULL,
  facet_strip_color = NULL,
  facet_strip_text_color = NULL
)

Arguments

base_size

Numeric. All text elements in the plot are scaled based on this size.

transparent

Should the plot output type be transparent? (default is FALSE) FALSE gives the plot a 'white' background.

title_textbox

Logical. If the ggtext::element_textbox_simple() should be used or not. Default is TRUE because this will automatically wrap the text if it's too long.

title_position

Character. Where should plot text/subtitle and caption be located. One of panel and plot(default). Pass in a vector (plot.title, plot.caption) if you want different positions for plot.title and plot.caption.

x_grid, y_grid

Logical. Do you need the axis and panel grid lines on the x and y axis?

axis_text_size

Numeric. Size of axis text. Pass in a vector (x, y) if you want different sizes for x and y axis.

axis_title_size

Numeric. Size of axis title Pass in a vector (x, y) if you want different sizes for x and y axis.

facet_strip_bg, facet_strip_color, facet_strip_text_color

Character. Color for facet strip background, border and text..

Value

An updated ggplot theme object.

Details

Below we show all colors stored in the populace_pal() function

Examples


library(ggplot2)

ggplot(diamonds, aes(x = clarity, fill = color)) +
  geom_bar(position = position_dodge()) +
  theme_populace() 


## Get rid of axis lines
ggplot(diamonds, aes(x = clarity, fill = color)) +
  geom_bar(position = position_dodge()) +
  theme_populace(x_grid = FALSE,
                 y_grid = FALSE)