简体   繁体   中英

Plotly in Juypter Notebook On Kaggle

I am trying to render a plotly graph in a Juypter Notebook (on Kaggle), and the code runs, but does not render an image. Using Plotly version 1.12.12, and Python 3.5. The output cell seems to just be hidden. Code for simple graph is below:

# Imports 
import plotly.plotly as py
import plotly.graph_objs as go
from plotly import tools
from plotly.offline import iplot, init_notebook_mode
init_notebook_mode(connected=True) 
# Graph
iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}])

I found some comments at the following link:

https://community.plot.ly/t/offline-mode-in-jupyter-notebook-shows-blank-graphs/1860/22

Still was not able to solve the issue. Any advice?

Thank You

Your code looks like OK, here you are your code result.

在此输入图像描述

First have you install plotly?

pip install plotly

Second try like this;

import plotly.plotly as py
import plotly.graph_objs as go
from plotly import tools
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot
init_notebook_mode(connected=True) 
# Graph
iplot([{"x": [1, 2, 3], "y": [3, 1, 6]}])

The solution to this question is that the charts will not appear until hitting the publish button on Kaggle. Unlike Matplotlib, you can not view the plotly chart until you publish.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM