This filter allows you to apply a custom kernel to your layer, thus giving
you more control than e.g. with_blur()
which is also applying a kernel.
with_kernel(
x,
kernel = "Gaussian:0x2",
iterations = 1,
scaling = NULL,
bias = NULL,
stack = FALSE,
...
)
A ggplot2 layer object, a ggplot, a grob, or a character string naming a filter
either a square matrix or a string. The string can either be a
parameterized kerneltype such as: "DoG:0,0,2"
or "Diamond"
or it can contain a custom matrix (see examples)
number of iterations
string with kernel scaling. The special flag "!"
automatically scales to full
dynamic range, for example: "50%!"
output bias string, for example "50%"
Should the original layer be placed on top?
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.
library(ggplot2)
# Add directional blur using the comet kernel
ggplot(mtcars, aes(mpg, disp)) +
with_kernel(geom_point(size = 3), 'Comet:0,10')