Skip to contents

A list of layer-like objects, which can be used in layer operations (through function application or multiplication) or added to a ggplot2::ggplot2() object.

Usage

layer_list(...)

as_layer_list(x)

# S3 method for class 'layer_list'
as_layer_list(x)

# S3 method for class 'list'
as_layer_list(x)

# S3 method for class 'LayerInstance'
as_layer_list(x)

# S4 method for class 'layer_list,layer_list'
e1 + e2

# S4 method for class 'layer_list'
show(object)

Arguments

x, ...

layer-like objects

object, e1, e2

layer_list()s

Value

An object of class "layer_list".

Details

For the most part, users of ggblend need not worry about this class. It is used internally to simplify multiple dispatch on binary operators, as the alternative (list()s of ggplot2::layer()s) is more cumbersome. ggblend converts input lists to this format as needed.

Examples

library(ggplot2)

# layer_list()s act just like list()s of layer()s in that they can
# be added to ggplot() objects
data.frame(x = 1:10) |>
  ggplot(aes(x, x)) +
  layer_list(
    geom_line(),
    geom_point()
  )