define_theme | R Documentation |
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.
define_theme(
strata = NULL,
fontsizes = NULL,
fontfamily = "Helvetica",
grid = FALSE,
bg = "transparent",
legend_position = NULL
)
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 |
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' |
Nested list with styling preferences for a ggplot object
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"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.