trouble generating pdf using nbconvert and bokeh. The bokeh plots do not show up in the pdf

362 views
Skip to first unread message

Krishna Bhogaonker

unread,
May 23, 2017, 6:16:35 PM5/23/17
to Project Jupyter
Hey Folks. 

I was hoping someone could shed some light on this issue. I cannot seem to get jupyter notebook to export a pdf with bokeh plots. I have a notebook in jupyter 4.3.0. When I use the usual nbconvert command, `jupyter nbconvert -to pdf notebook.ipynb --output notebook.pdf`. The notebook seems to compile properly and gives the right messages as such:

[NbConvertApp] Converting notebook notebook.ipynb to pdf
[NbConvertApp] Writing 350653 bytes to notebook.tex
[NbConvertApp] Building PDF
[NbConvertApp] Running pdflatex 3 times: ['pdflatex', 'notebook.tex']
[NbConvertApp] Running bibtex 1 time: ['bibtex', 'notebook']
[NbConvertApp] WARNING | bibtex had problems, most likely because there were no citations
[NbConvertApp] PDF successfully created
[NbConvertApp] Writing 208111 bytes to notebook.pdf

I am using bokeh 12.5 and nbconvert 4.2.

But for some reason none of my plots come out. I have markdown text and code in the notebook, both of which are 
exported just fine. Has anyone else had the same trouble? Are there any steps I am missing? Or do I need to export 
latex first and compile manually? 
Krishna


Thomas Kluyver

unread,
May 24, 2017, 9:24:52 AM5/24/17
to Project Jupyter
Hi Krishna,

I think Boken produces plots as HTML, which we can't convert to Latex. There may be a way to include a PNG copy of them which will work for the PDF conversion, but I don't know enough about Bokeh to know if that's possible or how you'd do it.

Thomas

--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+unsubscribe@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/19b88c75-9863-4096-b5fb-290647b8b7bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Krishna Bhogaonker

unread,
May 24, 2017, 1:03:21 PM5/24/17
to Project Jupyter
Okay, seems I confirmed the info from @takeowl with the bokeh developers. Right now bokeh will only let you nbconvert to HTML. You cannot export to pdf or latex yet, since there is not ability to export bokeh images to svg/png. BUT, the good news is that apparently in the next release of Bokeh, v. 12.6, this svg/png feature will become available. The new version of bokeh should come out in 2 weeks or so.

This is an excerpt from Gitter, 

Krishna Bhogaonker @00krishna 09:39 5/24/2017
Say, am I able to export bokeh plots with nbconvert? Considering that bokeh plots are kept as html and not png, I was not sure that this is possible. Are there workarounds for this?
Looks like this is not possible as of at least 2015 or 2016. If that is the case, then perhaps this needs to be more prominently indicated in the readme or something.
Otherwise, people will engage in substantial development only to find out that they cannot export.

Bryan Van de Ven @bryevdv 09:46 5/24/2017
nbconvert to plain HTML has always been possible, and still is (I just tested it earlier today, in fact)
there are issues with Reveal.js but nothing apart from that
PNG/SVG export is coming in the next release
otherwise if you think there should be changes to docs, a PR is the best suggestion
Reply all
Reply to author
Forward
0 new messages