matplotlib2---overview of plotting Functions: plot, scatter,bar, fill, imshow,contour,arrow,hist...

本文详细介绍了Matplotlib中最常用的绘图函数,包括一维数据的plot、scatter、bar和fill系列函数;二维数据的imshow、pcolor、contour及矢量场图的arrow、quiver等;同时涵盖了描述数据分布的hist、boxplot和violinplot函数。通过具体代码实例,帮助读者快速掌握这些函数的使用方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

matplotlib有大量的绘图函数,在pyplot文档中有完整的列表,Matplotlib gallery中有大量的绘图实例。

在此文章中先介绍几种最常用的绘图函数,并对其中的一些绘图函数做详细的介绍。

1. 一维数据

plot绘制 线之类函数
code:http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/plot_example.py
在这里插入图片描述

scatter 绘制散点图
code:
http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/scatter_example.py
在这里插入图片描述

bar 绘制矩形块组成的图像, 各种条形图
code:http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/bar_example.py
在这里插入图片描述

fill/fill_between 填充多边形
code:
http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/fill_example.py
在这里插入图片描述

2 . 二维数据: 2维数组或图像

imshow: 显示图像或颜色映射的数组
code:
http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/imshow_example.py
在这里插入图片描述

pcolor/pcolormesh: 显示颜色映射的二维数组
code:
http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/pcolor_example.py
在这里插入图片描述

**contour, contourf, clabel: 用于绘制等值线图, 等高线等 **
code:
http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/contour_example.py
在这里插入图片描述

3. 矢量场图

arrow/quiver/streamplot: 绘制带箭头的矢量场图
code:
http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/vector_example.py
在这里插入图片描述

4. 描述数据分布情况

hist/boxplot/violinplot: 用于描述统计分布的图例
code
http://nbviewer.jupyter.org/github/matplotlib/AnatomyOfMatplotlib/blob/master/examples/statistical_example.py
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值