theme_d6: A custom ggplot2 theme.

View source: R/theme_d6.R

theme_d6R Documentation

A custom ggplot2 theme.

Description

A dedicated theme for graphics created within the D6, with sensible defaults and additional options. It is based on the light theme and uses the custom typefaces PT Sans (defaul) and PT Serif (optional).

Usage

theme_d6(
  base_size = 14,
  base_family = "PT Sans",
  grid = "xy",
  legend = "bottom",
  mono = "none",
  bg = "transparent",
  serif = FALSE,
  margin = rep(base_size/2, 4),
  ...
)

Arguments

base_size

Numeric. The base sizes used for theme elements, defaults to 14 (which is slightly larger than in the default themes which use 11).

base_family

Character. The base font family, defaults to PT Sans. Typefaces need to be installed locally.

grid

Character. Should the panel grid be drawn? Specify "" or code"none" to draw no grid or any combination of "x", "X", "y", and "Y" to draw horizontal (y) and/or vertical (x) grid lines.

legend

Character or numeric vector. The position of legends as to be used in the `theme()` function: either "none", "left", "right", "bottom", or "top", or a two-element numeric vector specifying the relative x and y coordinates to place the legend inside the panel.

mono

Character. Should the axis and/or legend text be formatted as tabular, mono-spaced font? Specify the axes with "x", "X", "y", and "Y" and the legend as "legend", "l" or "L". If you want to use the base family, set "" or "none" (default).

bg

Color. The color used for the plot background, defaults to transparent.

serif

Logical. Should Sans or Sans Serif fonts be used? Default is FALSE.

margin

Vector. The plot margin four-element numeric vector specifying the margin on the top, right, bottom, and left. Defaults to rep(base_size / 2, 4)

...

Other arguments passed to complete ggplot2 themes.

Examples

library(ggplot2)
ggplot(mpg, aes(x = class, y = cty, color = class)) + geom_boxplot() +
  theme_d6(grid = "y", bg = "grey90", legend = "top", mono = "y")

EcoDynIZW/d6 documentation built on March 21, 2024, 12:41 a.m.