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.
svg_filter(svg, id, width = NULL, height = NULL, filters = list())
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 |
# 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" ) )#>#> #> #> #> #> #> #>