How to fix PlotlyRequestError?

爷,独闯天下 提交于 2020-07-06 08:54:50

问题


I get an 'PlotlyRequestError: No message' when I execute the code.

import plotly
import plotly.plotly as py
import plotly.graph_objs as go

Filedata = pd.read_csv('C:\\Documents\\Book4.csv')
data = [go.Scatter(x=Filedata.ix[:,0],y=Filedata.ix[:,1])]
layout = go.Layout(
title='Analysis 2016',
xaxis=dict(title='Startdate'),
yaxis=dict(title='Conductivity'))

fig = go.Figure(data=data, layout=layout)
py.iplot(fig)

回答1:


This is because you are trying to plot online which requires credentials based authentication. To plot offline, use plotly.offline's plot class to accomplish this without authentication.

from  plotly.offline import plot

and then use this plot to plot your figure.




回答2:


I had the same issue and I don't know if you already found a solution, but importing plotly like this:

import plotly.plotly as py
import plotly.graph_objs as go
# these two lines allow your code to show up in a notebook
from plotly.offline import init_notebook_mode, iplot
init_notebook_mode()

And then calling iplot like this:

plotly.offline.iplot(...)

Solved my problem! Hope it helps :)



来源:https://stackoverflow.com/questions/44024385/how-to-fix-plotlyrequesterror

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!