Description Usage Arguments Value Examples
The svg_filter()
let's us create a named <filter>
element that we can
apply to any SVG elements (such as shapes). We can bundle one or more filter
elements by supplying a list of filter_*()
calls to the filters
argument.
1 |
svg |
The |
id |
The ID value to assign to the filter. This must be provided and it
should be unique among all |
width, height |
The lengths of |
filters |
A list of |
An svg
object.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | if (interactive()) {
# Set up an `svg_filter()` (called
# `"blur"`) that has the blur effect
# (using the `filter_gaussian_blur()`
# function); have the ellipse element
# use the filter by referencing it
# by name via the `"filter"` attribute
SVG(width = 200, height = 100) %>%
svg_filter(
id = "blur",
filters = list(
filter_gaussian_blur(stdev = 2)
)
) %>%
svg_ellipse(
x = 40, y = 40,
width = 50, height = 30,
attrs = svg_attrs_pres(
fill = "green",
filter = "blur"
)
)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.