Plotly.py: How to display plotly outputs on Github?

Created on 5 Feb 2018  路  11Comments  路  Source: plotly/plotly.py

I have plotly charts on a jupyter python notebook. Plotly charts work fine on my local system in the notebook. However, plotly charts are not displayed when I uploaded the same notebook to my github page.

Does anyone know how to display plotly charts on github?

Most helpful comment

Hi @hassenmorad , the issue is that github performs a static render of the notebooks and it doesn't include the embedded HTML/JavaScript that makes up a plotly graph. See https://help.github.com/articles/working-with-jupyter-notebook-files-on-github/

One nice option is to paste the link to your GitHub notebook into http://nbviewer.jupyter.org/, which will present a rich view of the notebook.

Hope that clear things up!

All 11 comments

@purvithakor It appears that you are working with an old version of jupyter notebook. Since your version requires to set the NotebookApp.iopub_data_rate_limit, but you didn't it (see the warning IOPub data rate exceeded), the plot cannot be displayed.
Upgrade both jupyter and notebook.

I'm having this same problem despite updated jupyter notebook & lab. Any suggestions?

Hi @hassenmorad , the issue is that github performs a static render of the notebooks and it doesn't include the embedded HTML/JavaScript that makes up a plotly graph. See https://help.github.com/articles/working-with-jupyter-notebook-files-on-github/

One nice option is to paste the link to your GitHub notebook into http://nbviewer.jupyter.org/, which will present a rich view of the notebook.

Hope that clear things up!

Thanks, @jonmmease :)

@jonmmease There seems to be a problem also with nbviewer, it's not rendering the plotly graphs when using R kernel? https://nbviewer.jupyter.org/github/anthonymakela/Traffic-accidents-Finland/blob/master/traffic_accident_analysis_finland.ipynb

Hello, are there no updates on this issue?

My idea was to have the plot to be shown on a static environment from GitHub notebook viewer as an image. My repos are private, so I can't use @jonmmease solution...

I was keen to write a personal quick-and-dirty solution considering plotly.io to_image and cufflinks iplot, but wasn't so far even able to have both packages working together due to incompatible versioning...

Does anyone have a better approach?

Full documentation about our renderer framework is here: https://plot.ly/python/renderers/ and this approach requires Orca to be installed, docs here: https://plot.ly/python/static-image-export/

Full documentation about our renderer framework is here: https://plot.ly/python/renderers/ and this approach requires Orca to be installed, docs here: https://plot.ly/python/static-image-export/

Can you please share how you did it? I don't seem to understand what to do to override the renderer.

Yes, check out the notebook I mentioned above: https://github.com/nicolaskruchten/plotly_img_test/blob/master/Untitled.ipynb you just call fig.show("png") or fig.show("svg")

Thanks @jonmmease

Was this page helpful?
0 / 5 - 0 ratings