Skip to contents

[Experimental] This function collects several lists if they are present. If absent, reasonable defaults are used. When strata are not defined in the theme, they default to grey50 and will not be presented in the legend.

Usage

define_theme(
  strata = NULL,
  fontsizes = NULL,
  fontfamily = "Helvetica",
  grid = FALSE,
  bg = "transparent",
  legend_position = NULL
)

Arguments

strata

named list containing the different strata and name:colour value pairs

fontsizes

named list containing the font sizes for different options

fontfamily

string with the name of a supported font

grid

boolean that specifies whether the major and minor grid should be drawn. The drawing of major and minor gridlines can be manipulated separately by using a boolean indicator in a named list with elements major and minor.

bg

string defining the colour for the background of the plot

legend_position

string defining the legend position. Valid options are NULL, 'top' 'bottom' 'right' 'left'

Value

Nested list with styling preferences for a ggplot object

Examples


theme <- visR::define_theme(
  strata = list("SEX" = list(
    "F" = "red",
    "M" = "blue"
  )),
  fontsizes = list(
    "axis" = 12,
    "ticks" = 10,
    "legend_title" = 10,
    "legend_text" = 8
  ),
  fontfamily = "Helvetica",
  grid = list(
    "major" = FALSE,
    "minor" = FALSE
  ),
  bg = "transparent",
  legend_position = "top"
)