visExport to print large png?
So I am using the function visExport() from Chrome, and it works correctly, but the image that it takes seems to be only the resolution of the browser. Since my network is large, I would like to take a very zoomed in view. So I could save the network as very large also, but that crashes my browser :)
Is there any other way we could somehow trick the function into thinking it's very zoomed in to create a large png file without needing to export a network that's let's say 10000 x 10000?
I am with the same problem. The visNetwork builds the graphs by vis.js library which use canvas technology. What the visNetwork does is save that canvas in png. The problem with that is that is almost impossible to transform a canvas into a high-resolution image. If there would be a way to transform the canvas from visnetwork in SVG would be amazing improvement, because we can print SVG in high resolution. Take a look in that comment: https://github.com/datastorm-open/visNetwork/issues/204#issuecomment-330947422
@DataStrategist @fmassicano I found this R package for converting JS plots into SVG/PDF. https://github.com/schmidtchristoph/js2graphic
Was hopeful this would be silver bullet, but the resolution doesn't appear to be that great here either (despite even the highRes arg):
g <-igraph::make_ring(n=20)
vn <- visNetwork::visIgraph(g)
tmp <- tempfile(fileext = ".pdf")
js2graphic::jsGraphic2Pdf(graphic = vn,
plotDims = c(950, 500, 40, 20),
highRes = TRUE,
outFile = tmp)
browseURL(tmp)
Not sure if anyone else can get it working better.
Notes on installing js2graphic
You'll need to have phantomjs installed on your system first. This worked for me on Mac: https://formulae.brew.sh/cask/phantomjs
brew install --cask phantomjs
## Make mac trust this software so you can use it
xattr -dr com.apple.quarantine "/usr/local/bin/phantomjs
