as_svg_group {emphatic}R Documentation

Wrap an emphatic object to part of an SVG

Description

This function wraps html in SVG group tags (i.e. <g>). This may then be wrapped in <svg> tags to create a stand-along SVG.

Usage

as_svg_group(
  x,
  width = 1200,
  height = 900,
  font_size = NULL,
  style = list(),
  visible = TRUE,
  extra = NULL,
  ...
)

Arguments

x

emphatic object

width, height

viewBox dimensions for SVG

font_size

CSS font-size. Default: NULL means to not adjust font size. Otherwise, use valid CSS font-size specification e.g. "3em", "22px" etc.

style

html tag styling to apply to the <pre> wrapper for the returned HTML

visible

should the group be visible? Default: TRUE. When animating, every frame other than the first should be set as visible = FALSE.

extra

extra tags to insert into group. default NULL

...

other arguments passed to as.character.emphatic()

Details

This function is used internall by both as_svg() and as_svg_anim()

Value

Character string containing representation as an SVG group element i.e. <g>. This result is suitable for combining with other SVG elements into a custom SVG document.

Examples

hl_diff('hello', 'there') |>
  as_svg_group() |>
  cat()

[Package emphatic version 0.1.8 Index]