Export graph to SVG.

sg_export_svg(sg, download = TRUE, file = "graph.svg", size = 1000,
  width = 1000, height = 1000, labels = FALSE, data = FALSE)

sg_export_img(sg, download = TRUE, file = "graph.png",
  background = "white", format = "png", labels = FALSE)

sg_export_img_p(proxy, download = TRUE, file = "graph.png",
  background = "white", format = "png", labels = FALSE)

sg_export_svg_p(proxy, download = TRUE, file = "graph.svg",
  size = 1000, width = 1000, height = 1000, labels = FALSE,
  data = FALSE)

Arguments

sg

An object of class sigmajsas intatiated by sigmajs.

download

set to TRUE to download.

file

Name of file.

size

Size of the SVG in pixels.

width, height

Width and height of the SVG in pixels.

labels

Whether the labels should be included in the svg file.

data

Whether additional data (node ids for instance) should be included in the svg file.

background

Background color of image.

format

Format of image, takes png, jpg, gif or tiff.

proxy

An object of class sigmajsProxy as returned by sigmajsProxy.

Examples

nodes <- sg_make_nodes() edges <- sg_make_edges(nodes, 17)
#> Warning: Argument `n` is deprecated
sigmajs() %>% sg_nodes(nodes, id, size) %>% sg_edges(edges, id, source, target) %>% sg_export_svg() %>% sg_button("export_svg", "download") # demo("export-graph", package = "sigmajs")