- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
全新的(今天)plotly
(Python) 并按照我的方式完成示例和概述。
plotly.offline.iplot 的方法签名声明:
figure_or_data -- a plotly.graph_objs.Figure or plotly.graph_objs.Data or
dict or list that describes a Plotly graph.
See https://plot.ly/python/ for examples of
graph descriptions.
那么为什么它不接受标题中的字典呢?
PlotlyError Traceback (most recent call last)
<ipython-input-34-dc2bdcac2527> in <module>()
----> 1 plotly.offline.iplot({'x': [1, 2, 3], 'y': [5, 2, 7]})
/Users/Pyderman/anaconda/lib/python2.7/site-packages/plotly/offline/offline.pyc in iplot(figure_or_data, show_link, link_text, validate)
104
105 from IPython.display import HTML, display
--> 106 figure = tools.return_figure_from_figure_or_data(figure_or_data, validate)
107
108 width = figure.get('layout', {}).get('width', '100%')
/Users/Pyderman/anaconda/lib/python2.7/site-packages/plotly/tools.pyc in return_figure_from_figure_or_data(figure_or_data, validate_figure)
1412 "plot option.\nHere's why you're "
1413 "seeing this error:\n\n{0}"
-> 1414 "".format(err))
1415 if not figure['data']:
1416 raise exceptions.PlotlyEmptyDataError(
PlotlyError: Invalid 'figure_or_data' argument. Plotly will not be able to properly parse the resulting JSON. If you want to send this 'figure_or_data' to Plotly anyway (not recommended), you can set 'validate=False' as a plot option.
Here's why you're seeing this error:
'y' is not allowed in 'figure'
Path To Error: ['y']
Valid attributes for 'figure' at path [] under parents []:
['layout', 'data']
Run `<figure-object>.help('attribute')` on any of the above.
'<figure-object>' is the object at []
为什么字典必须包含在列表中:
plotly.offline.iplot([{'x': [1, 2, 3], 'y': [5, 2, 7]}])
最佳答案
如果您提供一个字典,它假设您输入的是一个图形
,如果您输入一个列表,它假设您输入的是数据
。 Data
是一个列表,因为您可以在一个图中包含多个序列。例如
提供数据(注意,两行):
plotly.offline.iplot([
{'x': [1, 2, 3], 'y': [5, 2, 7]},
{'x': [1, 2, 3], 'y': [1, 2, 3])}])
等效的,但提供了一个图形:
plotly.offline.iplot({
'data': [
{'x': [1, 2, 3], 'y': [5, 2, 7]},
{'x': [1, 2, 3], 'y': [1, 2, 3])}]
#Could put layout, etc... here
})
关于python - 为什么 plotly.offline.iplot( {'x' : [1, 2, 3], 'y' : [5, 2, 7]}) 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34191028/
我有以下数据集: month is_member not_member 0 April 84 7 1 August 292 85 2 July 353 125 3
我可以解决以下错误吗:“DataFrame”对象没有属性“iplot”?我必须使用 pd.read_csv 为从 csv 文件导入的数据集的每个类别创建箱线图: dataset = pd.read_c
我可以解决以下错误吗:“DataFrame”对象没有属性“iplot”?我必须使用 pd.read_csv 为从 csv 文件导入的数据集的每个类别创建箱线图: dataset = pd.read_c
在过去的 2 个小时里,我一直在努力解决这个问题,但一直没有解决这个错误的方法 - 已经观看了 youtube 视频,通过了 stackoverflow,但我不明白这是哪里出了问题。请注意,我正在使用
一直在使用Python的plotly,但不断遇到上述相同的错误消息。我在 Anaconda 上安装了plotly,分别在 Jupyter 和 Spyder 上收到错误消息: #data manipul
当我运行 de 命令时: iplot(df_final[['ds', 'yhat']].set_index('ds').to_iplot()) 它绘制了以下图表: 观察结果之间的这种奇怪的联系是什么?
我在 R 中运行以下代码但失败了: load(url("http://pages.stat.wisc.edu/~karlrohe/netsci/data/madStuff.RData")) iplot
在 Jupyter Notebook 中显示图形时 plot() 和 iplot() 有什么区别? 最佳答案 我刚开始在 Python (3.6.6) 中使用 iplot()。我认为它使用 Cuffl
This is the image which i have generated using iplot in python 当我使用 iplot 函数时,如何显示相应的数据元素名称。我使用以下命令来
我一直在尝试下载在 google colaboratory 上使用 plotly 创建的图。到目前为止,这是我尝试过的: 我试过改变 files.download('foo.svg') 到 files
当我在 Mac 上的 PyCharm 中运行以下代码时: import numpy as np import pandas as pd from subprocess import check_out
我正在尝试在 Jupyter notebook 中创建一个 Sankey 图表,我的代码基于 the first example shown here . 我最终得到了这个,我可以运行它而不会出现任何
全新的(今天)plotly (Python) 并按照我的方式完成示例和概述。 plotly.offline.iplot 的方法签名声明: figure_or_data -- a plotly.grap
我是一名优秀的程序员,十分优秀!