matplotlib作图坐标轴不能显示中文

如下图横坐标没有显示正确的球星名字,那是因为matplotlib库里没有中文字体
这里写图片描述
添加代码:
from pylab import *
mpl.rcParams[‘font.sans-serif’] = [‘SimHei’] 后即可正确显示
这里写图片描述

猜你喜欢

转载自blog.csdn.net/htbeker/article/details/80354978