operation-class {ggblend}R Documentation

Layer operations

Description

Layer operations are composable transformations that can be applied to ggplot2 layer-like objects, such as stats, geoms, and lists of stats and geoms; see the layer-like documentation page for a description of valid layer-like objects.

Usage

## S4 method for signature 'operation'
show(object)

## S4 method for signature 'operation'
format(x, ...)

## S4 method for signature 'adjust'
format(x, ...)

## S4 method for signature 'affine_transform'
format(x, ...)

## S4 method for signature 'blend'
format(x, ...)

## S4 method for signature 'operation_composition'
format(x, ...)

## S4 method for signature 'nop'
format(x, ...)

## S4 method for signature 'operation_product'
format(x, ...)

Arguments

x, object

An operation.

...

Further arguments passed to other methods.

Details

operations can be composed using the + and * operators (see operation_sum and operation_product). Addition and multiplication of operations and layer-like objects obeys the distributive law.

operations can be applied to layer-like objects using * or ⁠|>⁠, with slightly different results:

Value

For show(), an invisible() copy of the input.

For format(), a character string representing the input.

Methods (by generic)

Examples

library(ggplot2)

# operations can stand alone
adjust(aes(color = x))

# they can also be applied to layers through multiplication or piping
geom_line() |> adjust(aes(color = x))
geom_line() * adjust(aes(color = x))

# layer operations act as a small algebra, and can be combined through
# multiplication and addition
(adjust(fill = "green") + 1) * blend("multiply")


[Package ggblend version 0.1.0 Index]