Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

plotly plots in jupyter notebooks: Validation fails when saving

I'am new to plotly and I'am having a problem with my plots when generating them inside jupyter notebooks.

Whenever I generate a plot, evrything works fine, but when I try to save the notebook I get an error message telling me that the notebook validation failed because it's not valid under any of the given schemas (example taken straight from the plot.ly webiste).

Here is an example:

import plotly.plotly as py
iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}])

I get the following message when I try to save the notebook: Notebook Validation failed: {u'data': [{u'y': [3, 1, 6], u'x': [1, 2, 3]}], u'layout': {}} is not valid under any of the given schemas:

{
 "data": [
  {
   "y": [
    3, 
    1, 
    6
   ], 
   "x": [
    1, 
    2, 
    3
   ]
  }
 ], 
 "layout": {}
}

Thank you!

like image 996
gerard baste Avatar asked Feb 16 '17 21:02

gerard baste


People also ask

How do I save a plot image in Jupyter Notebook?

Create a new figure or activate an existing figure. Add an axes to the figure using add_axes() method. Plot the given list. Save the plot using savefig() method.

What does %% do in Jupyter Notebook?

Both ! and % allow you to run shell commands from a Jupyter notebook. % is provided by the IPython kernel and allows you to run "magic commands", many of which include well-known shell commands. ! , provided by Jupyter, allows shell commands to be run within cells.

Why Plotly does not show in Jupyter lab?

JupyterLab Problems In order to use plotly in JupyterLab, you must have the jupyterlab-plotly extension installed as detailed in the Getting Started guide. When you install plotly , this extension is automatically made available to any JupyterLab 3. x installation in the same Python environment.

How do you save data on Jupyter Notebook?

Saving a Jupter notebook Saving your edits is simple. There is a disk icon in the upper left of the Jupyter tool bar. Click the save icon and your notebook edits are saved.


1 Answers

The ploty team fixed the issue, here is the ticket

Upgrading nbformat, with either

pip install --upgrade nbformat

or

conda update nbformat

fixes it.

like image 199
gerard baste Avatar answered Oct 22 '22 15:10

gerard baste