christophergandrud / networkD3

D3 JavaScript Network Graphs from R
http://christophergandrud.github.io/networkD3
652 stars 268 forks source link

How to programmatically save as PNG format? #303

Closed Reborn-J closed 4 months ago

Reborn-J commented 4 months ago

Is there a programmatic way to save as PNG format instead of saving from the R editor?

cjyetman commented 4 months ago

Not directly with functions from this package, but there are ways of exporting the HTML output and then reading that in and taking a snapshot of the output, e.g. with webshot or webshot2.

Keep in mind that this package produces interactive HTML/JavaScript, which does not translate perfectly into a static image, so some things you may want might not translate/export as you expect.

Reborn-J commented 4 months ago

Not directly with functions from this package, but there are ways of exporting the HTML output and then reading that in and taking a snapshot of the output, e.g. with webshot or webshot2.

Keep in mind that this package produces interactive HTML/JavaScript, which does not translate perfectly into a static image, so some things you may want might not translate/export as you expect.

Thank you for your quick response ! I’m very grateful for your help.