Two layers can be blended together in the literal sense (not like with_blend()) so that the result is the average of the two. This is the purpose of with_interpolate().

with_interpolate(x, bg_layer, src_percent, bg_percent = 100 - src_percent, ...)

Arguments

x

A ggplot2 layer object, a ggplot, a grob, or a character string naming a filter

bg_layer

The layer to blend with

src_percent, bg_percent

The contribution of this layer and the background layer to the result. Should be between 0 and 100

...

Arguments to be passed on to methods. See the documentation of supported object for a description of object specific arguments.

Value

Depending on the input, either a grob, Layer, list of Layers, guide, or element object. Assume the output can be used in the same context as the input.

See also

Other blend filters: with_blend_custom(), with_blend(), with_mask()

Examples

library(ggplot2)
ggplot(mpg, aes(class, hwy)) +
  as_reference(geom_boxplot(), 'box') +
  with_interpolate(geom_point(), bg_layer = 'box', src_percent = 70)