Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

with_interpolate

Blend two layerrs together by averaging them out


Description

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().

Usage

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)

ggfx

Pixel Filters for 'ggplot2' and 'grid'

v1.0.0
MIT + file LICENSE
Authors
Thomas Lin Pedersen [aut, cre] (<https://orcid.org/0000-0002-5147-4711>), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.