Skip to content

How to download figures from plotly.offline.iplot after setting atttribute image='svg' #1502

Closed
@sw-gong

Description

@sw-gong

It is said from the help(plotly.offline.iplot):

image (default=None |'png' |'jpeg' |'svg' |'webp') -- This parameter sets
the format of the image to be downloaded, if we choose to download an
image. This parameter has a default value of None indicating that no
image should be downloaded.

My understanding is that we can download the figure as the format of the image after setting this attribute. However, how can we download it? Please see the below code. Could anyone explain what should be down next in order to download the figure?

Alternatively, I can use plotly.offline.plot which return a html link and I can download the figure after openning the link. However, the downside is that the figure won't be shown inside the jupyter notebook.

import plotly
import plotly.graph_objs as go
init_notebook_mode(True)

img_name = 'my-plot'
data = [go.Scatter(x=[1, 2, 3], y=[3, 2, 6])]
plotly.offline.iplot(data, filename=img_name, image='svg')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions