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

Use plotly offline to save chart as image file

I’ve used plotly with great success, and I’ve been able save a chart as an image file with success. Now I’m learning to use plotly offline, both with iPython Notebook and with the generic offline version. But I can’t find any informaton on how to save my offline (iPython Notebook version or otherwise) chart as an image file. Any help would be appreciated.

1 Like

To save your image, just hover the mouse slightly above the image/title and you can see the save icon.

1 Like

I’m sorry. I probably didn’t make myself clear in my original post. I want this done programmatically. The chart isn’t to be displayed at all. Just saved as an image file.

1 Like

I’m also looking for the save possibility in offline mode.

For me empet’s method doesn’t work either, it never finishes with the message of ‘snapshotting is still in progress’.

same problem here:
I am using plotly offline in an ipython notebook and would like to save/export my plots and tables as pdf, but I did not find the syntax for this anywhere. Help is greatly appreciated!
@ empet and thauta:
this is not working for me either, png-generation fails. In any case I’d prefer pdf.

It seems that this feature (producing an image file in PDF/PNG/… programatically) is missing. It would be a very nice feature, though…

Take a look here how to save static images: https://plot.ly/python/static-image-export/

contacting plotly support resulted in:

  • community members may only export to PNGs Other formats are
    available with the profession plan: https://plot.ly/products/cloud/

  • At the moment it is not possible to programatically export an image while using offline, i.e. confirming @jpp

  • You do have the option to use the camera icon in the mode bar on hover. This worked for me using plotly offline 1.9.3 and chrome, but not Firefox @thauta

at empet: I believe the info you refer to is not working for plotly offline

1 Like

Are there plans to add this feature for offline usage? I was hoping to use these in email reports, but can absolutely not send data outside our organization.

1 Like

For what it is worth, in PlotlyJS.jl I can get true vector image pdf/eps/svg export as well as configurable png/jpeg exporting by getting the svg data from plotly offline, using librsvg to load that into cairo, and using cairo to render to the desired file type.

Thanks @sglyon - nice idea. I’ve been using PhantomJS or SlimerJS to programmatically render to a PNG file but it is not perfect (particularly for WebGL figures). The Cairo approach sounds interesting.

javascript:alert(1)//http://google.com/tests.jpg


I have used this without the login credentials. it worked. then stopped working I don’t know why.
Edit: I understood now you’re trying to run that kind of command offline. In the link I shared, It uses the online connection.
Such feature offline is not available yet maybe because the Offline stuff was released quite recently… Let’s hope for the best in future.

Is that true for plotly offline too ? I mean If i am using plotly offline , does clicking to the button generate image locally without going to plotly server ?

Yes. Image generation via the mode bar is done entirely client side.

I am also looking for this feature. I have already been using plotly python in offline mode in Jupyter Notebook, but I am unable to save the generated image programmatically.

+1 Exact same need.
To my opiniion: important feature to make offline mode fully operaionnal!

This is not really automatic, but in case someone else was wondering how to get a different format than PNG, I found the answer somewhere in the docs:

import plotly
import plotly.offline as offline

plotly.offline.init_notebook_mode()

offline.iplot({'data': [{'y': [4, 2, 3, 4]}], 
               'layout': {'title': 'Test Plot'}},
             image='svg')
2 Likes

Also for me this would be great. +1

I have a question about 3D plot (3D scatter plot). I need to export it in .U3D or .PRC format. Is that any way to do that?