Description Usage Arguments Value Examples
The svg_polyline() function adds a polyline to an svg object. The
polyline is drawn by connecting a series of points with straight lines. The
points can be provided as a vector that's exactly divisible by two, or, as a
formatted string that adheres to the specification of the points attribute
of the SVG <polyline> tag. All point positions are in units of px.
| 1 2 3 4 5 6 7 8 9 10 11 12 | 
| svg | The  | 
| points | A numeric vector of points (with alternating values for  | 
| stroke | The color of the stroke applied to the element (i.e., the outline). | 
| stroke_width | The width of the stroke in units of pixels. | 
| fill | The fill color of the element. | 
| opacity | The opacity of the element. Must be a value in the
range of  | 
| attrs | A presentation attribute list. The helper function
 | 
| anims | An animation directive list for the element. This should be
structured using the  | 
| filters | A filter directive list for the element. This is easily
created by using a list of  | 
| id | An optional ID value to give to the built tag. This is useful for modifying this element in a later function call or for interacting with CSS. | 
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 25 26 27 28 | if (interactive()) {
# Create an SVG with a single
# polyline element; here `points`
# is a numeric vector where pairs
# of values are the `x` and `y`
# point position
svg_1 <-
  SVG(width = 300, height = 300) %>%
    svg_polyline(
      points = c(
        10, 10, 15, 20, 20, 15, 25, 30, 30, 25,
        35, 40, 40, 35, 45, 50, 50, 45
      ),
      stroke = "blue"
    )
# Create the same SVG with a single
# polyline element; this time `points`
# is a formatted points string
svg_2 <-
  SVG(width = 300, height = 300) %>%
    svg_polyline(
      points =
        "10,10 15,20 20,15 25,30 30,25 35,40 40,35 45,50 50,45",
      stroke = "blue"
    )
}
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.