The svg_line() function adds a line to an svg object. The line is drawn
using a start point (x1 and y1) and an end point (x2 and y2) points.
These positions are in units of px.
svg_line( svg, x1, y1, x2, y2, stroke = NULL, stroke_width = NULL, opacity = NULL, attrs = list(), anims = list(), filters = list(), id = NULL )
| svg | The |
|---|---|
| x1, y1 | The |
| x2, y2 | The |
| 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. |
| 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. |
# Create an SVG with a single # line element svg <- SVG(width = 100, height = 50) %>% svg_line( x1 = 5, y1 = 5, x2 = 95, y2 = 45, stroke = "blue" )