View source: R/ggplot2_extensions.R
theme_rieke | R Documentation |
A custom ggplot2 theme based on my own personal preferences. This assumes the user (me) has the required custom fonts already installed.
theme_rieke(
base_size = 14,
title_ratio = 24/14,
title_family = "Playfair Display",
base_family = "IBM Plex Sans",
base_color = "#363a3c"
)
base_size |
base font size, given in pts |
title_ratio |
ratio of title font size to |
title_family |
font family for the plot title |
base_family |
font family for all text in the plot except the title |
base_color |
color for all text in the plot |
library(ggplot2)
# plotting with NULL families --- must install default fonts locally
# plotting with `title_ratio = 1` since not using the default of Playfair Display
ggplot(mtcars, aes(mpg, wt)) +
geom_point() +
theme_rieke(title_family = NULL,
base_family = NULL,
title_ratio = 1) +
labs(title = "The title is left-aligned and allows for **bold characters**",
subtitle = "You can also use any markdown formatting, including *italics*",
caption = "Note the use of break<br>for line breaks")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.