Black Lives Matter. Please consider donating to Black Girls Code today.

Export animated plots to animated GIF/PNG/SVG

All,

Really enjoy the latest version with the animated plots/frames, but missing the export to animated GIF/PNG/SVG (a la giphy).

Thanks,
Velizar

but missing the export to animated GIF/PNG/SVG

There’s no in-house to do this at the moment unfortunately. There might be a way though.

Starting with:

var gd = document.getElementById('graph')

Plotly.plot(gd, {
  data: data,
  layout: layout,
  frames: frames
})

var images = []

gd.on('plotly_animated', () => {
  Plotly.toImage(gd).then((img) => {
    images.push(img)
  })
})

Plotly.animate(gd)

// do something with `images` to combine into a gif

Thank you for the JavaScript code, but I’m using Python.