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, ...)
A ggplot2 layer object, a ggplot, a grob, or a character string naming a filter
The layer to blend with
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.
Depending on the input, either a grob
, Layer
, list of Layer
s,
guide
, or element
object. Assume the output can be used in the same
context as the input.
Other blend filters:
with_blend_custom()
,
with_blend()
,
with_mask()
library(ggplot2)
ggplot(mpg, aes(class, hwy)) +
as_reference(geom_boxplot(), 'box') +
with_interpolate(geom_point(), bg_layer = 'box', src_percent = 70)