3

I have a presentation with Holoviews (Bokeh) interactive plots. The presentation works fine with rise (inside the notebook), but when I convert it to slides with reveal.js (v3.6.0) locally, the output doesn't show up. Even post serving through the CDN doesn't fix the issue. Anyone encountered this before?

prosoitos
  • 6,679
  • 5
  • 27
  • 41
  • I haven't tried this with reveal.js directly, but it works fine with https://damianavila.github.io/RISE , which is based on reveal.js. There's an example notebook at https://pyviz.github.io/pyviz/tutorial/01_Workflow_Introduction.html . – James A. Bednar Feb 15 '18 at 11:34
  • Yes, as I mention in the post, it works fine with Rise. Which is why it's strange that the export with reveal.js somehow fails. – Scheherzaade Feb 16 '18 at 18:52
  • Ah, I think I'm not understanding what you are trying to do here, but it's clearly not something I've tried in any case. Good luck! – James A. Bednar Feb 18 '18 at 20:59
  • Thanks! What reveal.js allows one to do (or should in any case) is to export the slides as HTML which can be shared with others not using the Jupyter notebook. So if one, for example, wants to embed the presentation on one's homepage, the presentation needs to have been exported as HTML slides. – Scheherzaade Feb 20 '18 at 09:18
  • I think I can reproduce that, though I'm still not sure what commands you are invoking. If I take a [talk that works fine in RISE in Jupyter](https://anaconda.org/jbednar/bednar_index_2018) and save it to disk, I can convert it to shareable HTML using `jupyter nbconvert --to html Bednar_INDEX_2018.ipynb`. That works fine, with all plots included, but it's in a report format rather than individual slides. If I instead try to make slides using `jupyter nbconvert --to slides Bednar_INDEX_2018.ipynb` to use reveal.js, I don't see any HoloViews plots, which is presumably what you are reporting? – James A. Bednar Feb 21 '18 at 16:27
  • BTW, `jupyter nbconvert --to slides Bednar_INDEX_2018.ipynb` does work fine if the notebook is changed to use matplotlib in `hv.extension()` instead of bokeh, so it looks like it's an issue with bokeh+reveal.js, but only when exporting outside the notebook context (?). Also, the exported HTML file still doesn't look like individual slides, unless you do `jupyter nbconvert --to slides Bednar_INDEX_2018.ipynb --post serve`, which presumably isn't desirable because it still needs a live running process. – James A. Bednar Feb 21 '18 at 16:33
  • Thank you! I'm invoking the same commands as you and to serve locally I have reveal.js in the same working directory as my notebook. I'll try with the matplotlib extension and see how that goes. – Scheherzaade Feb 22 '18 at 13:35

1 Answers1

3

I raised an issue on the RISE site about this problem once I was able to reproduce it, and the RISE author pointed me to this issue on the Bokeh site that let me get it working in my case. The solution is simply not to tell RISE to skip the cell that contains hv.extension("bokeh"). That cell loads BokehJS, which is needed for any Bokeh-based plots to show up, and skipping it works fine for a live presentation but apparently not for any exported version. After telling RISE not to skip that cell, my example notebook now works fine when converted to .html using jupyter nbconvert --to slides Bednar_INDEX_2018.ipynb, and it can be converted to PDF as described in the RISE documentation. The PDF output isn't formatted perfectly, but the plots do all show up at least.

James A. Bednar
  • 3,195
  • 1
  • 9
  • 13
  • There's some stray text in the pdf output wherever a Bokeh toolbar would be, but if you turn off the toolbars, it should be usable: ``from holoviews.plotting.bokeh import ElementPlot`` ; ``ElementPlot.toolbar=None`` – James A. Bednar Feb 22 '18 at 15:29
  • Hurrah! Thanks a lot, James. I also raised the issue on Reveal, but they said that this might be more appropriate for stackoverflow. Anyway, the plots are finally showing now so I'm super glad. On the other hand, I'd hidden the input cells to show only the plots but now they are back. Guess that will need some more fiddling. Thanks a lot again :) – Scheherzaade Feb 22 '18 at 20:28