首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >KeyError:'plotly_domain‘

KeyError:'plotly_domain‘
EN

Stack Overflow用户
提问于 2016-07-27 21:10:47
回答 1查看 5.2K关注 0票数 4

我正在运行来自这里的代码

代码语言:javascript
复制
import plotly
import plotly.plotly as py
from plotly.tools import FigureFactory as FF

import numpy as np
import pandas as pd
print(plotly.__version__)
dataframe = pd.DataFrame(np.random.randn(100, 3),
                         columns=['Column A', 'Column B', 'Column C'])

fig = FF.create_scatterplotmatrix(dataframe, diag='histogram', index='Column A',
                                  colormap=['rgb(100, 150, 255)', '#F0963C', 'rgb(51, 255, 153)'],
                                  colormap_type='seq', height=800, width=800)
py.iplot(fig, filename = 'Custom Sequential Colormap')

我得到了一个错误:

代码语言:javascript
复制
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4 /Users/mona/PycharmProjects/PythonCodes/plotly_viz.py
1.12.4
This is the format of your plot grid:
[ (1,1) x1,y1 ]  [ (1,2) x2,y2 ]
[ (2,1) x3,y3 ]  [ (2,2) x4,y4 ]

Traceback (most recent call last):
  File "/Users/mona/PycharmProjects/PythonCodes/plotly_viz.py", line 14, in <module>
    py.iplot(fig, filename = 'Custom Sequential Colormap')
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/plotly/plotly/plotly.py", line 175, in iplot
    return tools.embed(url, **embed_options)
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/plotly/tools.py", line 443, in embed
    != session.get_session_config()['plotly_domain']):
KeyError: 'plotly_domain'

Process finished with exit code 1

你知道问题是什么吗?怎么解决?我是在巧妙地尝试,但我的第一次尝试碰巧是失败的!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2016-07-27 21:15:09

基于这个答案,尝试使用py.plot而不是py.iplot

在python中巧妙地使用域‘绘制散点图时

原因是iplot是用于ipython会话的。

票数 11
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38623249

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档