Save a Sankey diagram created via sankeyNetwork() to an HTML or PNG file. HTML files are created via htmlwidgets::saveWidget(). PNG files are converted from HTML files via webshot::webshot().

saveNetwork(
  network,
  folder_path = NULL,
  file_name = "temp",
  png = "create",
  html = "none",
  vwidth = network$width,
  vheight = network$height,
  zoom = 5,
  delay = 0.5,
  selfcontained = TRUE
)

Arguments

network

Network to save, i.e. result of sankeyNetwork().

folder_path

Path to the destination folder.

file_name

File name without file extension.

png

Should a png file be created and/or immediately opened? Can be either "none", "create" or "open".

html

Should an html file be created and/or immediately opened? Can be either "none", "create" or "open".

vwidth

Passed to webshot::webshot(). Viewport width in pixels. Defaults to network$width, i.e. the width that was set in sankeyNetwork().

vheight

Passed to webshot::webshot(). Viewport height in pixels. Defaults to network$height, i.e. the height that was set in sankeyNetwork().

zoom

Passed to webshot::webshot(). Zoom factor. 1 means actual size, 2 means 50% zoom, etc.

delay

Passed to webshot::webshot(). Time to delay before taking webshot, in seconds.

selfcontained

Passed to htmlwidgets::saveWidget(). Whether to save the HTML as a single self-contained file (with external resources base64 encoded) or a file with external resources placed in an adjacent directory. TRUE by default, but note that this does not always seem to work.