I'm having trouble displaying Greek letters when using the nbconvert python API. Is there a trick to dumping PNGs from the python API?
Interestingly, the images look fine when dumped from the command line via: jupyter nbconvert img_test.ipynb --to rst My function to dump the images is here (inspired by: http://nbconvert.readthedocs.io/en/latest/nbconvert_library.html#Extracting-Figures-using-the-RST-Exporter) import nbformat from nbconvert import RSTExporter nbfile = 'img_test.ipynb' basename, _ = os.path.splitext(nbfile) with open(nbfile, 'r') as nb: nbdata = nbformat.reads(nb.read(), as_version=4) body, images = RSTExporter().from_notebook_node(nbdata) with open(basename + '.rst', 'w') as rst_out: rst_out.write(body) for img_name, img_data in images['outputs'].items(): with open(img_name, 'wb') as img: img.write(img_name) Here the good image from the command line: <https://lh3.googleusercontent.com/-SZ6lmsbciH4/WJqABHJhVHI/AAAAAAAACHI/l83dIwp-zrIDA8NFccEtF4zHEQ9C6mSCgCLcB/s1600/cmd_line_good.png> <https://lh3.googleusercontent.com/-SZ6lmsbciH4/WJqABHJhVHI/AAAAAAAACHI/l83dIwp-zrIDA8NFccEtF4zHEQ9C6mSCgCLcB/s1600/cmd_line_good.png> Here's the bad image from the python function. Notice the difference in the x-axis label <https://lh3.googleusercontent.com/-lUNa8fXfv-s/WJqADEb3XDI/AAAAAAAACHM/5DedSlep72oEA1C6Qj9C754osm8apYytwCLcB/s1600/api_bad.png> Here's the notebook spec that generated both of those: { "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": false }, "outputs": [], "source": [ "%matplotlib inline\n", "from matplotlib.pyplot import subplots\n", "fig, ax = subplots()\n", "ax.set_xlabel('Alpha and Beta (α=0, β=1)')\n", "fig.tight_layout()" ] } ], "metadata": { "anaconda-cloud": {}, "kernelspec": { "display_name": "Python [default]", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.5.2" } }, "nbformat": 4, "nbformat_minor": 2 } This is on Windows 10, if that matters. Cheers, -Paul -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/16283222-6b35-4168-8aa8-b23b73693057%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
