数据可视化--matplotlib模块绘图的基本流程

使用matplotlib模块进行绘图流程

导入模块

import matplotlib.pyplot as plt

1.创建画布

plt.figure()

2.进行绘图

准备数据,进行绘图,进行图形添加修饰

#准备数据
x=[1,2,3,4,5]
y=[10,4,6,2,8]
#进行绘图  
#plot():绘制折线图
plt.plot(x,y)

3.图形展示

#图形展示
plt.show()

运行结果如图所示:

猜你喜欢

转载自blog.csdn.net/g_optimistic/article/details/92567387