解决matplotlib中文显示问题

在python中默认是不显示中文的,用matplotlib绘图时,汉字会显示一个方框,如下代码: import matplotlib.pyplot as plt squares = [1,4,9,16,25] plt.plot(squares, linewidth=5) #设置图表标题,并给坐标轴就加上标签 plt.title("平方数",fontsize=24) plt.xlabel("
相关文章
相关标签/搜索