theme_cond | R Documentation |
Method to change theme settings conditional on the type of plot such as geom, facet etc.
## S3 method for class 'conditional_theme' ggplot_add(object, plot, object_name)
object |
An object (theme) to add to the plot. |
plot |
The ggplot object to add |
object_name |
The name of the object to add. |
The original idea was to use:
plot$theme <- ggplot2:::add_theme(plot$theme, object, "object")
for this purpose but ggplot2:::add_theme
() is an internal ggplot2
function and is not exported.
Instead, the current theme in object
consist of theme_nish_*
settings. These theme properties are further modified based on the type of
plot requested in the ggplot2 call, i.e. based on the geom, facet etc.
outside the actual theme_nish_*
() call, by this method.
plot$theme
may initially (as input to this method) be an empty list if
no theme
() calls have been performed or set by the user in the working
environment. The argument object
always replaces an existing theme in
plot$theme
.
A ggplot object.
Conditional theme settings does not work with ggplot2::theme_set
().
Explicit theme_nish_*()
call is required by the user to enable
conditional theme settings.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.