Show Sidebar Hide Sidebar

Static Image Export

How to export plotly graphs as static images in python. Plotly supports png, svg, jpg, and pdf image export.

You can save static images using the following syntax:


import plotly.plotly as py
py.image.save_as({'data': data}, 'your_image_filename.png')

You can also display inline static images in IPython:


import plotly.plotly as py
py.image.ishow({'data': data})

Combine this with a GET request on a plot you (or someone else) has already created:


figure = py.get_figure('demos', '1571')
py.image.save_as(figure, 'your_image_filename.png')

This will save a static image of a plot you've pulled from Plotly's Servers.


You can view the static version of any Plotly graph by appending .png, .pdf, .eps, or .svg to the end of the URL.


For example, view the static image of https://plot.ly/~chris/1638 at https://plot.ly/~chris/1638.png.


Combine this with the requests package and download the latest version of your Plotly graph:


import requests

image_bytes = requests.get('https://plot.ly/~chris/1638.png').content



Still need help?
Contact Us

For guaranteed 24 hour response turnarounds, upgrade to a Developer Support Plan.