1

I have a notebook with plotly plot and I would like to export it to html with nbconvert :

jupyter nbconvert test.ipynb --no-input --to html

Notebook Example :

import numpy as np
import pandas as pd
import plotly.io as pio
pio.renderers.default='notebook'
pd.set_option("plotting.backend", "plotly")

df = pd.DataFrame(np.random.normal(0, 1, size=(150, 250)))
df.sum().cumsum().plot()

Randomly, the plot does not appear on the exported html, any ideas how to fix it ?

PJP
  • 51
  • 4
  • Had it worked for you before you on the system you are trying on? If you view the `.html` file in a code editor, do you see the huge block of javascript below something like `plotly.js v2.14.0`? Is your plotly up-to- date? Is the notebook set to 'trusted'? I just installed plotly using `%pip install plotly` after launching a session from [here](http://mybinder.org/v2/gh/binder-examples/requirements/master?urlpath=/tree/) and your code and process worked. (I ran the `jupyter nbconvert` step as you wrote it, over in a terminal launched in that session.) – Wayne Sep 08 '22 at 20:43
  • Is the code for the plot in the HTML but just not rendering? (My generated html file using your process was 14422 lines long.) Do you know if you are obtaining [require.js](https://stackoverflow.com/questions/66210187/exporting-jupyter-notebook-with-plotly-to-html-not-displaying-correctly-when-off#)? – Wayne Sep 08 '22 at 20:50

0 Answers0