python中用matplotlib作图汉字怎么显示,显示的是小方块
请问图片中xy坐标轴上文字显示不出怎么解决啊?
请问图片中xy坐标轴上文字显示不出怎么解决啊?
2017-04-09
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties
zhfont = FontProperties(fname=r'c:\windows\fonts\simsun.ttc',size=20)#指定本机的汉字字体位置
plt.title('标题',fontproperties=zhfont)
year = [1950,1970,1990,2010]
population = [2.519,3.692,5.263,6.972]
plt.plot(year,population)
plt.show()
举报