sigmajs (version 0.1.5)

sg_export_svg: Export

Description

Export graph to SVG.

Usage

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.

Value

An object of class htmlwidget which renders the visualisation on print. Functions ending in _p return the proxy.

Examples

Run this code
# NOT RUN {
nodes <- sg_make_nodes() 
edges <- sg_make_edges(nodes, 17)

sigmajs() %>% 
  sg_nodes(nodes, id, size) %>% 
  sg_edges(edges, id, source, target) %>% 
  sg_export_svg() %>% 
  sg_button("export_svg", "download")

# }

Run the code above in your browser using DataCamp Workspace