matplotlib —入门基础

import matplotlib.pyplot as plt

plt.rcParams["font.sans-serif"]=["SimHei"]
plt.rcParams["axes.unicode_minus"]=False # 解决中文乱码问题

fig, ax = plt.subplots()  # fig 画板   ax 图  
fig.dpi = 150  # dpi函数,设置画板大小
ax.bar(['5.5', '5.6', '5.8','5,9','5.10','5.11','5.12','5.13','5.14','5.15'], [15, 40, 43,39,45,35,30,15,16,45]) # bar 直方图
ax.set_title('五月份VX机器人使用量')  # set_titlt 标题
ax.set_xlabel('日期')  # set_xlabel X轴
ax.set_ylabel('使用量')  # set_ylabel y轴
plt.show()  # show() 展示画布

 


基础图形:
plot  直线图
scatter  点型图
bar  直方图

 

posted @ 2023-05-16 15:43  徐俊112  阅读(13)  评论(0)    收藏  举报