Use electron to export plotly.js graphs as images.
npm i
npm start
If you’re on Ubuntu (or maybe some other Linux distro) and you have
xvfb
installed,
you can run this things headlessly (no joke) with:
npm run start:headless
and see results in fig.png
.
You can also pass as argument any URL to a plotly "data"/"layout"
JSON or the
name of the plotly.js test
mock you’d
like to export. For example:
npm start -- gl3d_bunny
Using electron
the main
module sends plotly.js "data"/"layout"
JSON data
to the renderer
module. The renderer
calls Plotly.plot
and
Plotly.toImage
in succession and then sends the image data back to the main
module it writes a PNG file.
Some useful articles: