Hello Mike, dear list,

I am now able to generate a ps (and png) file with CJK characters (eps does NOT work).

But my paths was rather surprising:
* I put SimHei back at first position in matplotlibrc:
        font.sans-serif: SimHei, ~
* the following I took out of my dea.py:
        #import matplotlib
        #matplotlib.use('GtkCairo')
* also, I have taken out:
        #rcParams['font.sans-serif'] = ['Adobe Song Std']
        #rcParams['font.sans-serif'] = ['SimHei']
Note here that when I take the 'Adobe Song' line out, no CJK gets produced. The 'SimHei' line makes no difference.

I can confirm that:
In [9]: matplotlib.get_backend()
Out[9]: 'GTKCairo'

And: no eps gets generated.

Basically I therefore followed the instructions here [Chinese]:
http://hi.baidu.com/lijiangshui/blog/item/a0aad703cd65ee7e3812bb49.html

While eps generation continues not to work, my system is now, via ps2eps, productive.

Thanks for all your help, Mike!

David

Attachment: dea.ps
Description: PostScript document

#!/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'] = 12.0
#rcParams['font.sans-serif'] = ['Adobe Song Std']
#rcParams['font.sans-serif'] = ['SimHei']


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')
#xlab = plt.xlabel(u'shuru 1')
ylab = plt.ylabel(u'输入 2')
#ylab = plt.ylabel(u'shuru 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.ps')
------------------------------------------------------------------------------
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

Reply via email to