Plotly graph does not show when jupyter notebook is converted to slides

plotly not showing in jupyter lab
plotly blank plot jupyter
plotly doesn't show
jupyter does not show plot
plotly map not showing
plotly show figure in spyder
plotly title not showing
figure' object has no attribute 'show plotly

I have a jupyter notebook with interractive plotly plots. I am converting that notebook into slides using nbconvert. When I do so the plotly plots do not show up in the slides. I get the following tornado warnings as well

$ jupyter nbconvert presentation.ipynb --to slides --post serve
[NbConvertApp] Converting notebook presentation.ipynb to slides
[NbConvertApp] Writing 818538 bytes to presentation.slides.html
[NbConvertApp] Redirecting reveal.js requests to https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.1.0
Serving your slides at http://127.0.0.1:8000/presentation.slides.html
Use Control-C to stop this server
WARNING:tornado.access:404 GET /custom.css (127.0.0.1) 1.53ms
WARNING:tornado.access:404 GET /custom.css (127.0.0.1) 0.96ms
WARNING:tornado.access:404 GET /plotly.js (127.0.0.1) 0.84ms

To add insult to injury this worked yesterday and I don't think I changed anything substantial. I tried rebooting my browser and my machine and neither helped.

1) Check the JS console for errors and the Jupyter log if you are serving the slides via Jupyter. When you browse the slides.html, you may be getting 404 GET /files/mydir/plotly.js

put the plotly.js file in the directory where the slides.html is located (download e.g. https://cdn.plot.ly/plotly-latest.min.js and rename to plotly.js)

2) make sure you are specifying a Layout height and width in your Jupyter notebook e.g.

trace_data = [trace1]
layout = Layout(
    autosize=False,
    width=720,
    height=480,
    margin=Margin(
        l=50,
        r=50,
        b=100,
        t=100,
        pad=4
    ),
    bargroupgap=0.3
)
fig = Figure(data=trace_data, layout=layout)

Re-run your charts, check they appear properly in the notebook, save the notebook, re-run nbconvert.

You do not need to customize the custom.css and make a myreveal.tpl Reveal template and specify it on the nbconvert command line, but you can do so if you wish to customize your slides.

nbconvert --to slides compatability offline mode · Issue #355 · plotly , I'd like to create a plotly figure in an ipython notebook in offline mode, -graph-​does-not-show-when-jupyter-notebook-is-converted-to-slides  If I convert the following notebook to html, the output html file does not contain any graphics output. import plotly.graph_objs as go mesh = go.Mesh3d(x=[0,1,0],y=[0,0,1],z=[0,0,0],i=[0],j=[1],k=[2],flatshading=False,color='#333333') go.FigureWidget([mesh]) However, if I use the old-fashioned:

Following the code found here : https://nbviewer.jupyter.org/format/slides/github/tarokiritani/testjupyter/blob/master/test%20plotly.ipynb#/

I have found adding plotly.offline.init_notebook_mode(connected=True) into the same cell as the plotly.offline.(i)plot function works

plotly not compatible with nbviewer/nbconvert, slide view · Issue , My plot is rendered nicely when my jupyter notebook is seen with nbviewer and convert again with: Plotly plots do not show in slides #484. plotly not compatible with nbviewer/nbconvert, slide view #750. tarokiritani opened this issue May 5, 2017 · 3 comments. My plot is rendered nicely when my jupyter notebook is seen with nbviewer as a notebook. However, in the slide mode, the image is very narrow. Here is my plot viewed in a slide.

You must have a plotly.js file in your directory where you are performing nbconvert. For some reason, "to html" will embed the plotly javascript into the HTML file, but "to slides" searches for a plotly.js file in the directory.

That said, you will have to template reveal.js to change dimensions of the slides depending on the size of your plot charts. That, or customize the dimension of the plotly graphs. If the slide are too big (or the other way around), the graphs will collapse into one line in the slides.

Offline Mode in Jupyter Notebook shows blank graphs, 0, but I still have the problem. I have tried to add 'init_notebook_mode(connected​=True)', but does not work. I'd like to create a plotly figure in an ipython notebook in offline mode, export it using nbconvert --to slides, and view it using reveal.js. I think this is in principle possible because

Jupyter Notebook Tutorial | Python, List of hotkeys is shown in Help > Keyboard Shortcuts (list is extended from time to share notebook file (.ipynb), but not everyone is using notebooks, so the options are. convert notebooks to html file; share it with gists , which are rendering the interactive plots; plot.ly can generate nice plots, but those will cost you money  I had the same problem with plotly not displaying in a notebook in Kaggle. Due to my use of qgrid, I need to run the notebook, then fresh the browser and then run the notebook again in order for qgrid to properly display the df.

Boosting Your Jupyter Notebook Productivity, Taking care of jupyter environment # show graphs in-line, and turn on/off np # So we can use random numbers in examples # Must enable in order to use plotly embed in ipython notebook! plotly.offline.iplot(data, filename='basic-scatter'). This renderer is intended for use in the classic Jupyter Notebook (not JupyterLab). The full plotly.js JavaScript library bundle is added to the notebook the first time a figure is rendered, so this renderer will work without an Internet connection.

Graphs and Plots using Plotly, Jupyter Notebooks are a spin-off project from the IPython project, which used to I don't want the code cells to be visible at all (not some button that turn them The conversion run by the kernel uses Python's standard-library lib2to3 module. How to export a JupyterLab notebook to a slide presentation, without showing​  Plotting Inline¶. You can use Plotly's python API to plot inside your Jupyter Notebook by calling plotly.plotly.iplot() or plotly.offline.iplot() if working offline. Plotting in the notebook gives you the advantage of keeping your data analysis and plots in one place.

Comments
  • Did you find out how to get it working? I have the same for saving to markdown.
  • No, I never got this to work.
  • Thank you!, just putting the plotly.js file worked for me.