filter_image: Filter: display an image

Description Usage Arguments Value Examples

View source: R/filters.R

Description

Display an image using a URL or a relative path to an on-disk resource.

Usage

1

Arguments

image

A link or path to an image resource.

Value

An svg object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
if (interactive()) {

# Place an image (obtained via an image
# link) within a rectangle element using
# the `filter_image()` filter
SVG(width = 500, height = 500) %>%
  svg_filter(
    id = "image",
    filters = list(
      filter_image(
        image = "https://www.r-project.org/logo/Rlogo.png"
      )
    )
  ) %>%
  svg_rect(
    x = 25, y = 25,
    width = "50%", height = "50%",
    attrs = svg_attrs_pres(filter = "image")
  )
}

rich-iannone/omsvg documentation built on March 11, 2021, 5:13 p.m.