Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python KeyError:';plotly#u域';_Python_Python 3.x_Plot_Plotly_Keyerror - Fatal编程技术网

Python KeyError:';plotly#u域';

Python KeyError:';plotly#u域';,python,python-3.x,plot,plotly,keyerror,Python,Python 3.x,Plot,Plotly,Keyerror,我正在从以下位置运行代码: 我得到了这个错误: /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

我正在从以下位置运行代码:

我得到了这个错误:

/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
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4/Users/mona/PycharmProjects/PythonCodes/plotlyviz.py
1.12.4
这是打印网格的格式:
[(1,1)x1,y1][(1,2)x2,y2]
[(2,1)x3,y3][(2,2)x4,y4]
回溯(最近一次呼叫最后一次):
文件“/Users/mona/PycharmProjects/PythonCodes/plotly_viz.py”,第14行,在
py.iplot(图,文件名='Custom Sequential Colormap')
文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site packages/plotly/plotly/plotly.py”,第175行,在iplot中
返回tools.embed(url,**嵌入选项)
文件“/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site packages/plotly/tools.py”,第443行,嵌入
!= session.get_session_config()['plotly_domain']):
KeyError:“plotly\u域”
进程已完成,退出代码为1

你知道问题是什么,如何解决?我一直在尝试,但即使是第一次尝试也没有成功

根据此答案,尝试使用
py.plot
而不是
py.iplot

原因是
iplot
用于ipython会话

/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