一:动态加载
import matplotlibfrom pylab import mplmyfont=matplotlib.font_manager.FontPRoperties(filename='c:/windows/fonts/simkai.ttf',size=14)plt.plot(x,y)plt.title(u'加油',fontproperteries=myfont) ##字体路径设置给图表plt.show()## 词云中文显示from Wordcloud import WordCloudimport osfont_path=os.environ.get('FONT_PATH',,os.path.join(os.path.dirname('C/windows/fonts'),'simkai.ttf'))wc=WordCloud(font_path=font_path).generate(seg_list)plt.figure()plt.imshow(wc)plt.axis("off")plt.show()## used codecsimport codecsf=codecs.open(filename,'r','mbcs') ##codecs can make chinese okhttp://www.crifan.com/tutorial_python_codecs_process_file_char_encoding/
新闻热点
疑难解答