Description Usage Arguments Examples
Themes allow customization of default values that can be defined in a single
place. Using a CascadingTheme allows minimal repetition in defining these
values. Normally, a Graphic will be rendered by the Builder using
with_theme()
, such that a set of defaults is available. Any function that
gets called by the Builder or Renderer can use theme()
to make a default
value configurable.
1 2 3 4 5 6 | theme(
key,
default = abort(glue::glue("No value for `theme('{key}')`"), "no_theme_key")
)
with_theme(cascading_theme, expr)
|
key |
A key |
default |
A value to return if key is not defined in the current theme |
cascading_theme |
A CascadingTheme (or something else with a |
expr |
An expression to evaluate with |
1 2 3 4 5 6 | # if there is no theme set, the default value is returned
theme("first", "a sensible default value")
# with a theme set
test_theme <- CascadingTheme$new()$set_values("first" = 1)
with_theme(test_theme, 2 * theme("first"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.