Skip to contents

Quick theme for a ggplot visualisation.

Usage

gg_theme(
  text_family = "",
  text_size = 10,
  text_pal = "#323232",
  text_face = "plain",
  title_size = text_size * 1.1,
  title_pal = "#000000",
  title_face = "bold",
  title_position = "plot",
  title_hjust = 0,
  title_vjust = 1,
  title_margin = ggplot2::margin(t = title_size * -0.5, b = title_size * 1.75),
  subtitle_size = text_size,
  subtitle_pal = "#323232",
  subtitle_face = "plain",
  subtitle_hjust = 0,
  subtitle_vjust = 1,
  subtitle_margin = ggplot2::margin(t = subtitle_size * -1.5, b = subtitle_size * 1.75),
  caption_size = text_size * 0.9,
  caption_pal = "#88837D",
  caption_face = "plain",
  caption_position = "plot",
  caption_hjust = 0,
  caption_vjust = 0,
  caption_margin = ggplot2::margin(t = caption_size * 1.25),
  background_pal_plot = "#F1F3F5",
  background_pal_panel = "#FEFEFE",
  background_pal_key = NULL,
  line_linewidth = 0.125,
  line_pal = "#323232",
  ticks_pal = NULL,
  ticks_linewidth = NULL,
  ticks_length = grid::unit(text_size/4, "pt"),
  gridlines_linewidth = 0.1,
  gridlines_pal = "#D3D3D3"
)

Arguments

text_family

The font family for all text to use. Defaults to "".

text_size

The size of all text other than the title, subtitle and caption. Defaults to 10.

text_pal

The colour for all text other than the title, subtitle or caption. Defaults to "#323232".

text_face

The font style of all text other than the title, subtitle or caption. Defaults to "plain".

title_size

The size of the title text_family. Defaults to 11.

title_pal

The colour for the title text_family. Defaults to "#000000".

title_face

The font style of the title text_family. Defaults to "bold".

title_position

The horizontal alignment of the title (and subtitle) to either "plot" or "panel".

title_hjust

The horizontal adjustment for the title.

title_vjust

The vertical adjustment for the title.

title_margin

The margin for the title. A ggplot2::margin function.

subtitle_size

The size of the subtitle text_family. Defaults to 10.

subtitle_pal

The colour for the subtitle text_family. Defaults to "#323232".

subtitle_face

The font style of the subtitle text_family. Defaults to "plain".

subtitle_hjust

The horizontal adjustment for the subtitle.

subtitle_vjust

The vertical adjustment for the subtitle.

subtitle_margin

The margin for the title. A ggplot2::margin function.

caption_size

The size of the caption. Defaults to 9.

caption_pal

The colour for the caption. Defaults to "#88837D".

caption_face

The font style of the caption. Defaults to "plain".

caption_position

The horizontal alignment of the caption to either "plot" or "panel".

caption_hjust

The horizontal adjustment for the caption.

caption_vjust

The vertical adjustment for the caption.

caption_margin

The margin for the caption. A ggplot2::margin function.

background_pal_plot

The colour for the plot background colour. Defaults to "#F1F3F5".

background_pal_panel

The colour for the panel background colour. Defaults to "#FEFEFE".

background_pal_key

The colour for the legend key. Defaults to the background_pal_plot.

line_linewidth

The linewidth of the axis. Defaults to 0.125.

line_pal

The colour for the axis. Defaults to "#323232".

ticks_pal

The colour for the ticks. Defaults to the line_pal.

ticks_linewidth

The linewidth of the ticks. Defaults to that of the line_linewidth argument.

ticks_length

The length of the ticks. A grid::unit function.

gridlines_linewidth

The linewidth of the vertical major gridlines. Defaults to 0.1.

gridlines_pal

The colour for the vertical major gridlines. Defaults to "#D3D3D3".

Value

A ggplot theme.