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

Using py.image.save_as to save image as displayed

I am new to plot.ly so I appreciate people’s help.

I have produced an image that I can view via (offline) iplot in a jupyter notebook and then when I try to save it with py.image.save_as it changes the image (grid is different for example).

I have looked at the plot.ly documentation for offline image saving where they recommend to use the entry image=‘png’ (although I need an svg file) and tried the example:

import plotly.offline as offline
import plotly.graph_objs as go

offline.init_notebook_mode()

offline.iplot({‘data’: [{‘y’: [4, 2, 3, 4]}],
‘layout’: {‘title’: ‘Test Plot’,
‘font’: dict(size=16)}},
image=‘png’)

but it gives me an error:

TypeError Traceback (most recent call last)
in ()
7 ‘layout’: {‘title’: ‘Test Plot’,
8 ‘font’: dict(size=16)}},
----> 9 image=‘png’)

TypeError: iplot() got an unexpected keyword argument ‘image’

I was hoping that to try image = ‘svg’ to see if that would render the same displayed in the notebook to the one I saved, but apparently iplot does not accept image as argument.

Any ideas? Thank you