本文介绍了KeyError:在Python中使用plotly进行散点图时的"plotly_domain"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用plotly进行散点图.该图形是在我的帐户上生成的,但是终端仍然报告错误:
I'm using plotly to do scatter plot. The graph is generated on my account but the terminal still reports an error:
Traceback (most recent call last):
File "IEORE4709HW1.py", line 106, in <module>
py.iplot(data, filename='basic-scatter')
File "/Library/Python/2.7/site-packages/plotly/plotly/plotly.py", line 175, in iplot
return tools.embed(url, **embed_options)
File "/Library/Python/2.7/site-packages/plotly/tools.py", line 412, in embed
!= session.get_session_config()['plotly_domain']):
KeyError: 'plotly_domain'
我的代码是:
import urllib2
import numpy as np
import plotly.plotly as py
py.sign_in('halblooline', 'j90503v8gq')
import plotly.graph_objs as go
import numpy as np
N = 1000
random_x = np.random.randn(N)
random_y = np.random.randn(N)
# Create a trace
trace = go.Scatter(
x = random_x,
y = random_y,
mode = 'markers'
)
data = [trace]
# Plot and embed in ipython notebook!
py.iplot(data, filename='basic-scatter')
# or plot with: plot_url = py.plot(data, filename='basic-line')
有人可以帮助我吗?非常感谢.
Any one could help me with this? Thank you very much.
推荐答案
使用py.plot而不是py.iplot.试试看.
use py.plot instead of py.iplot. Have a try.
这篇关于KeyError:在Python中使用plotly进行散点图时的"plotly_domain"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!