【发布时间】:2018-04-05 05:46:48
【问题描述】:
当我保存带有绘图图的 jupyter 笔记本时,我收到以下错误:
[E 13:42:38.458 NotebookApp] Notebook JSON is invalid: {'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['data']['patternProperties']['^(?!application/json$)[a-zA-Z0-9]+/[a-zA-Z0-9\\-\\+\\.]+$']:
{'oneOf': [{'type': 'string'},
{'items': {'type': 'string'}, 'type': 'array'}]}
On instance['data']['application/vnd.plotly.v1+json']:
{'data': [{'type': 'scatter', 'y': [1, 2, 3]}], 'layout': {}}
我在笔记本上的代码是:
import plotly.offline as py
import plotly.graph_objs as go
py.init_notebook_mode(connected=True)
data = [go.Scatter(y=[1,2,3])]
py.iplot(data)
在plotly plots in jupyter notebooks: Validation fails when saving 之后,我更新了 nbformat,但仍然无法正常工作(我检查了 import nbformat nbformat__version__ 更新工作)
【问题讨论】:
-
我遇到了同样的问题。将这些示例中的任何一个复制并粘贴到 jupyter 笔记本中(并将最后一行更改为离线绘图)会重现验证错误。 plot.ly/python/choropleth-maps
标签: python jupyter-notebook plotly