Skip to contents

Renders and saves a hex sticker to SVG. Requires the svglite package. Rendering finishes in a temporary file beside the destination before replacing it, so a failed export preserves any previous file. The previously selected graphics device is restored.

Usage

save_hex_svg(sticker, filename, width = 2)

Arguments

sticker

A ggplot object returned by hex_sticker().

filename

Character. Output file path. Must end in .svg.

width

Numeric. Width in inches. Default 2.

Value

The filename path, invisibly.

Details

Save a hex sticker to an SVG file

Examples

if (requireNamespace("svglite", quietly = TRUE)) {
  s <- hex_sticker("mypackage")
  tmp <- tempfile(fileext = ".svg")
  save_hex_svg(s, tmp)
}