示例#

关于我们提供的绘图方法的概述,请参见 图表类型

本页包含示例图表。点击任意图片查看完整图片和源代码。

对于更长的教程,请参阅我们的 教程页面。您还可以在我们的 用户指南 中找到 外部资源常见问题解答

标签化!

您也可以通过 标签 浏览示例图库。

线条、条形和标记#

带有单独条形颜色的条形图

Bar chart with individual bar colors

带有标签的条形图

Bar chart with labels

堆叠柱状图

Stacked bar chart

带标签的分组条形图

Grouped bar chart with labels

水平条形图

Horizontal bar chart

断开的条形图

Broken Barh

CapStyle

CapStyle

绘制分类变量

Plotting categorical variables

绘制两个信号的一致性

Plotting the coherence of two signals

交叉谱密度 (CSD)

Cross spectral density (CSD)

带有误差带的曲线

Curve with error band

误差条限值选择

Errorbar limit selection

误差条子采样

Errorbar subsampling

事件集合演示

EventCollection Demo

事件图演示

Eventplot demo

填充多边形

Filled polygon

fill_between 带透明度

fill_between with transparency

填充两条线之间的区域

Fill the area between two lines

填充两条垂直线之间的区域

Fill the area between two vertical lines

带渐变的条形图

Bar chart with gradients

帽子图

Hat graph

离散分布作为水平条形图

Discrete distribution as horizontal bar chart

JoinStyle

JoinStyle

虚线样式配置

Dashed line style configuration

带有勾选路径效果的线条

Lines with a ticked patheffect

线条样式

Linestyles

标记参考

Marker reference

Markevery 演示

Markevery Demo

绘制掩码和NaN值

Plotting masked and NaN values

多色线条

Multicolored lines

将标记属性映射到多变量数据

Mapping marker properties to multivariate data

功率谱密度 (PSD)

Power spectral density (PSD)

散点图演示2

Scatter Demo2

带有直方图的散点图

Scatter plot with histograms

带有掩码值的散点图

Scatter plot with masked values

标记示例

Marker examples

带有图例的散点图

Scatter plot with a legend

线图

Line plot

使用 fill_between 填充由逻辑掩码定义的阴影区域

Shade regions defined by a logical mask using fill_between

频谱表示

Spectrum representations

堆叠图和流图

Stackplots and streamgraphs

楼梯演示

Stairs Demo

Stem plot

Stem plot

步骤演示

Step Demo

带有线条、日期和文本的时间线

Timeline with lines, dates, and text

hlines 和 vlines

hlines and vlines

交叉相关和自相关

Cross- and auto-correlation

图像、轮廓和场#

图像的仿射变换

Affine transform of an image

风羽

Wind barbs

条形码

Barcode

交互式调整色图范围

Interactive adjustment of colormap range

颜色映射归一化

Colormap normalizations

颜色映射归一化 SymLogNorm

Colormap normalizations SymLogNorm

轮廓角掩码

Contour corner mask

等高线演示

Contour Demo

等高线图像

Contour image

等高线标签演示

Contour Label Demo

等高线填充演示

Contourf demo

等值线填充图案

Contourf hatching

Contourf 和 对数颜色标度

Contourf and log color scale

优化解决方案空间的轮廓

Contouring the solution space of optimizations

BboxImage 演示

BboxImage Demo

图图像演示

Figimage Demo

带注释的热图

Annotated heatmap

图像重采样

Image resampling

使用补丁裁剪图像

Clipping images with patches

多种绘制图像的方法

Many ways to plot images

带有掩码值的图像

Image with masked values

图像非均匀

Image nonuniform

在2D图像中混合透明度和颜色

Blend transparency with color in 2D images

修改坐标格式化器

Modifying the coordinate formatter

imshow 的插值

Interpolations for imshow

不规则间隔数据的等高线图

Contour plot of irregularly spaced data

使用 alpha 混合层叠图像

Layer images with alpha blending

使用 matshow 可视化矩阵

Visualize matrices with matshow

带有单个颜色条的多个图像

Multiple images with one colorbar

pcolor 图像

pcolor images

pcolormesh 网格和阴影

pcolormesh grids and shading

pcolormesh

pcolormesh

流线图

Streamplot

QuadMesh 演示

QuadMesh Demo

高级箭袋和箭袋键功能

Advanced quiver and quiverkey functions

Quiver 简单演示

Quiver Simple Demo

阴影示例

Shading example

频谱图

Spectrogram

间谍演示

Spy Demos

三重轮廓演示

Tricontour Demo

Tricontour 平滑 Delaunay

Tricontour Smooth Delaunay

Tricontour 平滑用户

Tricontour Smooth User

Trigradient 演示

Trigradient Demo

Triinterp 演示

Triinterp Demo

Tripcolor 演示

Tripcolor Demo

Triplot 演示

Triplot Demo

水印图片

Watermark image

子图、轴和图形#

对齐标签和标题

Align labels and titles

以编程方式控制子图调整

Programmatically control subplot adjustment

坐标轴方框比例

Axes box aspect

坐标轴演示

Axes Demo

使用边距和粘性边缘控制视图限制

Controlling view limits using margins and sticky_edges

Axes 属性

Axes properties

坐标轴缩放效果

Axes zoom effect

绘制跨越一个轴的区域

Draw regions that span an Axes

等轴长宽比

Equal axis aspect ratio

轴标签位置

Axis label position

断开的轴

Broken axis

自定义图表子类

Custom Figure subclasses