Peter Cheng
Peter Cheng

Reputation: 5

Usage of plotly libraries in python

I'm using the plotly library to perform data analysis. However, I encounter a problem when trying to update the data as per the official documentation. The following error message appears,

enter image description here

Given below is my code.

import plotly.plotly as py
import plotly.graph_objs as go
trace0 = go.Scatter(
    x=[3, 4],
    y=[2, 1]
)
trace1 = go.Scatter(
    x=[3, 4],
    y=[3, 2]
)
trace2 = go.Scatter(
    x=[3, 4],
    y=[4, 3]
)
data = [trace0, trace1, trace2]

plot_url = py.offline.plot(data, filename='extend plot', fileopt='extend')

Any help is appreciated. Thanks.

Upvotes: 0

Views: 87

Answers (3)

Gijs Wobben
Gijs Wobben

Reputation: 2085

That's not possible. The offline plot function has no "fileopt" parameter and cannot be extended. Use the online version if you really need to.

Upvotes: 1

Arka Mallick
Arka Mallick

Reputation: 1316

First try to do import plotly as py then py.offline.plot. Might work.

Also you need to set up you credentials for offline processing first. import plotly plotly.tools.set_credentials_file(username='DemoAccount', api_key='lr1c37zw81')

something like this. Please check out the link here link here also this one

I think that will solve your problem.

Upvotes: 0

dave-cz
dave-cz

Reputation: 413

You should use plotly.offline if you want to generate a HTML file.

import plotly.offline as py
# ...
py.plot(data, filename='extend plot', auto_open=False)

Upvotes: 0

Related Questions