Builds a theme function from ggplot2::theme() elements and
an optional base theme. The returned function applies the theme
to a plotit object and can be used anywhere style() is used.
Usage
make_theme(name, ..., base_theme = ggplot2::theme_minimal)Arguments
- name
Name for the theme function as a string (e.g.
"style_dark").- ...
Theme elements passed to
ggplot2::theme().- base_theme
A base ggplot2 theme function (default: ggplot2::theme_minimal).
Examples
style_dark <- make_theme("style_dark",
plot.background = ggplot2::element_rect(fill = "#1a1a1a"),
text = ggplot2::element_text(colour = "white"))
if (FALSE) { # \dontrun{
plotit(iris, encode(x = Sepal.Width, y = Sepal.Length)) |>
mark_point() |> style_dark()
} # }