theme_foundation: Foundation Theme

View source: R/theme-foundation.R

theme_foundationR Documentation

Foundation Theme

Description

This theme is designed to be a foundation from which to build new themes, and not meant to be used directly. theme_foundation() is a complete theme with only minimal number of elements defined. It is easier to create new themes by extending this one rather than theme_gray() or theme_bw(), because those themes define elements deep in the hierarchy.

Usage

theme_foundation(
  base_size = 12,
  base_family = "",
  ink = "black",
  paper = "white",
  accent = "#3366FF"
)

Arguments

base_size

base font size, given in pts.

base_family

base font family

ink, paper, accent

colour for foreground, background, and accented elements respectively.

Details

This theme takes theme_gray() and sets all colour and fill values to NULL, except for the top-level elements (line, rect, and title), which have colour = ink, and fill = paper. This leaves the spacing and-non colour defaults of the default ggplot2 themes in place.

Unlike theme_foundation(), the other themes in this package (e.g. theme_economist(), theme_excel(), theme_hc()) intentionally replicate a fixed, published visual style, so they do not expose ink/paper/accent arguments.

Value

A ggplot2 theme object (class theme).

See Also

Other themes: theme_base(), theme_clean(), theme_igray(), theme_par(), theme_solid()

Examples

library("ggplot2")

ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point() +
  theme_foundation()

# Extend the foundation to build a new theme
theme_minimal_box <- function(...) {
  theme_foundation(...) +
    theme(
      panel.grid = element_blank(),
      axis.ticks = element_line()
    )
}

ggplot(mtcars, aes(x = wt, y = mpg)) +
  geom_point() +
  theme_minimal_box()

ggthemes documentation built on Oct. 4, 2026, 1:06 a.m.