The svg_text() function adds text to an svg object. As with many of the
functions that create shape elements (such as svg_rect()), the starting
position is defined by x and y values. All point positions are in units
of px.
svg_text( svg, x, y, text, fill = NULL, opacity = NULL, path = NULL, attrs = list(), anims = list(), filters = list(), id = NULL )
| svg | The |
|---|---|
| x, y | The |
| text | A character vector that contains the text to be rendered. |
| fill | The color of the text. |
| opacity | The opacity of the element. Must be a value in the
range of |
| path | A single-length character vector that holds the formatted path string. |
| 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 # text element svg <- SVG(width = 300, height = 300) %>% svg_text( x = 10, y = 20, text = "A line of text" )