System details
RStudio Edition : Desktop
RStudio Version : 1.1.463
OS Version : Windows 7 Professional
R Version : 3.5.1
Steps to reproduce the problem
Run the following code in R Studio
library(networkD3)
URL <- paste0(
"https://cdn.rawgit.com/christophergandrud/networkD3/",
"master/JSONdata/energy.json"
)
Energy <- jsonlite::fromJSON(URL)
sankeyNetwork(Links = Energy$links, Nodes = Energy$nodes, Source = "source",
Target = "target", Value = "value", NodeID = "name",
units = "TWh", fontSize = 12, nodeWidth = 30)
then on the Viewer
tab select either Save as Image
or Copy to Clipboard
and choose a width of 1,000 and a height of 618. Proceed to save and/or copy the plot and notice that it's cropped all weird. Here's what it looks like. Seems like a bug.
A workaround is to save the html widget as a html file first, then use webshot
to save it down as png file. But I don't like workarounds. What's wrong?
htmlwidgets::saveWidget(m, file="m.html")
webshot::webshot("m.html", "m.png")