layer-like | R Documentation |
For technical reasons related to how ggplot2 implements layers, there is no single class from which all valid ggplot2 layers and lists of layers inherit. Thus, ggblend operations supports a variety of "layer-like" objects, documented here (see Details).
is_layer_like(x)
as_layer_like(x)
## Default S3 method:
as_layer_like(x)
## S3 method for class 'LayerInstance'
as_layer_like(x)
## S3 method for class 'list'
as_layer_like(x)
## S3 method for class 'layer_list'
as_layer_like(x)
x |
A layer-like object. See Details. |
ggblend operations can be applied to several ggplot2::layer()
-like objects,
including:
objects of class "LayerInstance"
; e.g. stat
s and geom
s.
list()
s of layer-like objects.
layer_list()
s, which are a more type-safe version of list()
s of
layer-like objects.
Anywhere in ggblend where a function parameter is documented as being layer-like, it can be any of the above object types.
For is_layer_like()
, a logical
: TRUE
if x
is layer-like, FALSE
otherwise.
For as_layer_like()
, a "LayerInstance"
or a layer_list()
.
is_layer_like()
: checks if an object is layer-like according to ggblend.
as_layer_like()
: validates that an object is layer-like and converts
it to a "LayerInstance"
or layer_list()
.
library(ggplot2)
is_layer_like(geom_line())
is_layer_like(list(geom_line()))
is_layer_like(list(geom_line(), scale_x_continuous()))
is_layer_like(list(geom_line(), "abc"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.