绘图和可视化--Matplotlib

来源:互联网 发布:英语广播电台软件下载 编辑:程序博客网 时间:2024/06/05 20:33
Matplotlib是一个强大的Python绘图和数据可视化的工具包。

安装方法:pip installmatplotlib
引用方法:importmatplotlib.pyplotasplt

绘图函数:plt.plot()
显示图像:plt.show()

plot函数:
线型linestyle(-,-.,--,..)
点型marker(v,^,s,*,H,+,x,D,o,…)
颜色color(b,g,r,y,k,w,…)
plot函数绘制多条曲线plt.plot([1,2,3],[3,2,1],'^-.y',[4,5,6,7],[2,7,9,8],'*--g')
标题:set_title
x轴:set_xlabel
y轴:y_label

其他类型图像:
hist  频数直方图
画布:figure
fig=plt.figure()
图:subplot
ax1=fig.add_subplot(2,2,1)
调节子图间距:
subplots_adjust(left,bottom,right,top,wspace,hspace)

原创粉丝点击