From: oyster <lep...@gm...> - 2014-09-26 08:58:03
|
hi, all following is a simple plot. however, if I turn on xkcd(), the legend shows Chinese as "??". I think this is because the Chinese characters can not be found in a western font. Is there a way to fix this? thanks [code begin] #coding=utf-8 import math from pylab import * x=range(0, int(2*math.pi*1000)) x=[i/1000.0 for i in x] y1=[math.sin(i) for i in x] xkcd() p=plot(x, y1) legend(p, [u'sin曲线']) rcParams['font.sans-serif'] = ['SimHei'] #set the default font to a Chinese Font #show() savefig('%s.png' % __file__) |