Black Lives Matter. Please consider donating to Black Girls Code today.
Dash HoloViews is now available! Check out the docs.

"Save as png" button

Is it possible to create button, which on-click will be save image of graph. I know about button in top of grap, but i relly need to create this button!
P.S. Is it possible, somehow, to save image of graph using right-mouse-button and selecet “save image…”


Hello! Plotly/Dash allows static image download. write a function to call the following:

from IPython.display import Image

1 Like

I believe that this will only work in the Jupyter context.

1 Like

@chriddyp my bad! Thank You for pointing it out, I wouldn’t have realized.

So, this is what worked for me. You can function call this through a button click. However, if you’re using plotly.offline, this line downloads the html of the plot as well.

#format: 'png', 'svg', 'jpeg', 'pdf'

Something else you can do is hover on the graph and the first icon on the top right corner is to ‘Download as PNG’