Hi: I am getting an error when I save a figure as PDF with a particular configuration and when I use a greek latex leter (say $\alpha$) as a ylabel. The following code illustrates the problem.
############################################### import matplotlib.pyplot as plt import matplotlib as mpl params = { 'text.usetex' : True, 'font.family': 'serif', 'font.serif' : ['Times'], } mpl.rcParams.update(params) plt.figure() plt.plot([1,2,3]) plt.ylabel(r'$\alpha$') plt.savefig('f1.pdf') ############################################### When I run it I get Traceback (most recent call last): File "multipage_pdf.py", line 14, in <module> plt.savefig('f1.pdf') File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 472, in savefig return fig.savefig(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/figure.py", line 1173, in savefig self.canvas.print_figure(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 2027, in print_figure **kwargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 1799, in print_pdf return pdf.print_pdf(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 2187, in print_pdf file.close() File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 470, in close self.writeFonts() File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 557, in writeFonts fonts[Fx] = self.embedTeXFont(filename, self.dviFontInfo[filename]) File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_pdf.py", line 622, in embedTeXFont t1font = t1font.transform(fontinfo.effects) File "/usr/local/lib/python2.7/dist-packages/matplotlib/type1font.py", line 301, in transform buffer.write(value) TypeError: unicode argument expected, got 'str' Note that with any of the following variations the code works as expected: - If I use plt.ylabel(r'$x_2$') instead of plt.ylabel(r'$\alpha$). - If I save as PNG instead of PDF. - Use the default configuration (comment the mpl.rcParams.update(params) line). I am using MPL verion 1.2.x (built from commit 396a6446). Am I doing something wrong? Any idea how to solve it? Alejandro. ------------------------------------------------------------------------------ Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users