问题遇到的现象和发生背景
1 Mac系统 vscode
使用Matplotlib制作图表时,不显示中文的坐标轴标签。
代码
结果:
问题相关代码,请勿粘贴截图
import matplotlib.pyplot as plt
aquares = [1,4,9,16,25]
fig,ax = plt.subplots()
ax.plot(aquares,linewidth = 3)
ax.set_title("square", fontsize= 24)
ax.set_xlabel("值",fontsize = 20)
ax.set_ylabel("平方的值",fontsize = 24)
ax.tick_params(axis= 'both',labelsize= 14)
plt.show()
运行结果及报错内容
坐标轴无法显示中文标签
我的解答思路和尝试过的方法
我想要达到的结果
显示中文标签。