import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']#使坐标轴和标题中文显示
plt.bar([1, 3, 5, 7, 9], [5, 4, 8, 12, 7], label='graph 1')
# x: 条形图x轴
# y:条形图的高度
# width:条形图的宽度 默认是0.8
# bottom:条形底部的y坐标值 默认是0
plt.legend()
plt.xlabel('横坐标')
plt.ylabel('纵坐标')
plt.title('条形图')
plt.show()
python创建条形图且使坐标轴和标题中文化显示
最新推荐文章于 2023-12-10 09:34:27 发布