visnet_save: visNetwork save

View source: R/visnet_save.R

visnet_saveR Documentation

visNetwork save

Description

Save a visNetwork object as a png.

Usage

visnet_save(
  url,
  file = gsub("\\.html", ".png", url),
  res = 8,
  delay = 0.2,
  zoom = 1,
  vwidth = 992 * res,
  vheight = 744 * res,
  geometry = NULL,
  run_shrink = FALSE
)

Arguments

url

A vector of URLs to visit. If multiple URLs are provided, it will load and take screenshots of those web pages in parallel.

file

A vector of names of output files. Should end with an image file type (.png, .jpg, .jpeg, or .webp) or .pdf. If several screenshots have to be taken and only one filename is provided, then the function appends the index number of the screenshot to the file name. For PDF output, it is just like printing the page to PDF in a browser; selector, cliprect, expand, and zoom will not be used for PDFs.

res

Resolution multiplier.

delay

Time to wait before taking screenshot, in seconds. Sometimes a longer delay is needed for all assets to display properly.

zoom

A number specifying the zoom factor. A zoom factor of 2 will result in twice as many pixels vertically and horizontally. Note that using 2 is not exactly the same as taking a screenshot on a HiDPI (Retina) device: it is like increasing the zoom to 200 doubling the height and width of the browser window. This differs from using a HiDPI device because some web pages load different, higher-resolution images when they know they will be displayed on a HiDPI device (but using zoom will not report that there is a HiDPI device).

vwidth

Viewport width. This is the width of the browser "window".

vheight

Viewport height This is the height of the browser "window".

geometry

Scaling specification. Can be a percent, as in "50%", or pixel dimensions like "120x120", "120x", or "x120". Any valid ImageMagick geometry specification can be used. If filename contains multiple images, this can be a vector to specify distinct sizes for each image.

run_shrink

Run shrink on the png.

Value

png file path

Examples

save_path <- tempfile(fileext = ".html")
res <- dep_graph(pkg = "echoverse",
                 layout=layout_star,
                 save_path=save_path)
visnet_save(url = "https://datastorm-open.github.io/visNetwork/")

RajLabMSSM/echodeps documentation built on Oct. 31, 2023, 7:20 a.m.