Dear Michael, thanks for your input. So far, though, no luck.
I have deleted "SimHei" in matplotlibrc, and I can then continue generating CJK characters. The png is generated, the eps is not. Thus, no change. The error output is also the same:
RuntimeError: Face has no glyph names WARNING: Failure executing file: <dea.py> I have tried import matplotlib matplotlib.use('GtkCairo')as you suggested, but they had no effect whatsoever. Even the error output is the same.
I attach my code, maybe that gives a hint. Note: in line 327 and 328 of the matplotlibrc I have added ps.fonttype=42 pdf.fonttype=42 whereas I have uncommented pdf.fonttype : 3 Any ideas? I would most welcome any hint and suggestion! Many thanks, David On 17/03/10 04:15, Michael Droettboom wrote:
The font you are using (SimHei) does not have any glyph names -- these are used in the Postscript backend to refer to glyphs outside of the ASCII range. More specifically, it looks like it has at least one invalid glyph name (glyph names can only contain ASCII characters) -- loading it in FontForge complains about this. I haven't come across such a font before, but maybe that's common in CJK fonts. I don't know. I'm looking through the spec to find a way that glyphs can be referenced without a name, but I'm not finding one. Note, the PDF backend has the same issue. Do you have the same problem if you remove "SimHei" from the font.sans-serif list and thus use "Adobe Song Std" instead? (I was able to find an online download of SimHei to test with, but not Adobe Song Std). As a workaround, the Cairo backend seems to handle this font just fine. You can add import matplotlib matplotlib.use('GtkCairo') to the top of your script. Mike David wrote:Hello everybody, I have a final problem with my graph. As a last step I produce an *.eps file that I use in conjunction with LaTeX. Here is the last part of my code: # plt.title('Title') xlab = plt.xlabel(u'输入 1') #xlab.set_position((0.2, 0.1)) ylab = plt.ylabel(u'输入 2') plt.grid(True) plt.subplots_adjust(bottom=0.2) plt.show() plt.savefig('dea.eps') plt.show() produces the correct output, but plt.savefig('dea.eps') produces an error (the error message is attached). The error is clearly linked to the Chinese, as it runs through if I take the Chinese out of the code. Also, plt.savefig('dea.png') works fine. Could anyone indicate where I would have to look for the mistake? The matplotlibrc should be fine, but I am not sure. Your help would be greatly appreciated! Many thanks, David ------------------------------------------------------------------------ ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev ------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
<<attachment: dea.png>>
#!/usr/bin/python # -*- coding: utf-8 -*- # http://suyonggui.blog.sohu.com/115269389.html # http://hi.baidu.com/lijiangshui/blog/item/a0aad703cd65ee7e3812bb49.html #import matplotlib #matplotlib.use('GtkCairo') import matplotlib.pyplot as plt from pylab import * #rcParams['figure.figsize'] = 3.56, 2.22 rcParams['figure.figsize'] = 4, 3 rcParams['axes.labelsize'] = 14.0 #rcParams['font.sans-serif'] = ['Adobe Song Std'] label = ('A', 'B', 'C', 'E') shuru1 = [1, 2, 4, 5] shuru2 = [4, 2, 1, 1] plt.plot([0,3], [0,3], 'k--', lw=2) plt.plot([3], [3], 'ko', ms=6) plt.plot(shuru1, shuru2, 'k-', lw=2) plt.plot(shuru1, shuru2, 'ko', ms=6) plt.axis([0, 6, 0, 5]) # plt.title('Title') xlab = plt.xlabel(u'è¾å ¥ 1') ylab = plt.ylabel(u'è¾å ¥ 2') text( 1, 4.2, u'A') text( 1.95, 2.2, u'B') text( 4, 1.2, u'C') text( 5, 1.2, u'E') text( 3, 3.2, u'D') plt.grid(True) plt.subplots_adjust(bottom=0.2) #plt.show() plt.savefig('dea.png') plt.savefig('dea.eps')
------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev
_______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users