matplotlib.pyplot.axhspan#

matplotlib.pyplot.axhspan(ymin, ymax, xmin=0, xmax=1, **kwargs)[源代码][源代码]#

在 Axes 上添加一个水平跨度(矩形)。

矩形从 ymin 垂直延伸到 ymax,默认情况下,水平方向上覆盖整个 x 轴。x 轴的范围可以通过 *xmin*(默认值:0)和 *xmax*(默认值:1)来设置,这些值以轴单位表示;例如,xmin = 0.5 总是指 x 轴的中点,无论 set_xlim 设置的限制如何。

参数:
ymin浮动

跨度的较低 y 坐标,以数据单位表示。

ymax浮动

跨度的上y坐标,以数据单位表示。

xminfloat, 默认值: 0

跨度的x坐标下限,以x轴(0-1)单位表示。

xmaxfloat, 默认值: 1

跨度的上x坐标,以x轴(0-1)单位表示。

返回:
Rectangle

从 (xmin, ymin) 到 (xmax, ymax) 的水平跨度(矩形)。

其他参数:
**kwargs : Rectangle 属性矩形属性

属性

描述

agg_filter

一个过滤函数,它接收一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组和两个从图像左下角开始的偏移量

alpha

标量或None

angle

未知

animated

布尔

抗锯齿 或 aa

布尔值或无

边界

(左,底,宽,高)

capstyle

CapStyle 或 {'butt', 'projecting', 'round'}

clip_box

BboxBase 或 None

clip_on

布尔

clip_path

补丁或(路径,变换)或无

颜色

color

edgecolor 或 ec

color or None

facecolor 或 fc

color or None

figure

FigureSubFigure

fill

布尔

gid

str

hatch

{'/', '', '|', '-', '+', 'x', 'o', 'O', '.', '*'}

高度

未知

in_layout

布尔

joinstyle

JoinStyle 或 {'miter', 'round', 'bevel'}

标签

对象

linestyle 或 ls

{'-', '--', '-.', ':', '', (偏移, 开-关-序列), ...}

linewidth 或 lw

浮点数或无

鼠标悬停

布尔

path_effects

AbstractPathEffect 列表

picker

None 或 bool 或 float 或 callable

光栅化

布尔

sketch_params

(scale: float, length: float, randomness: float)

snap

布尔值或无

transform

Transform

url

str

可见

布尔

宽度

未知

x

未知

xy

(浮点数, 浮点数)

y

未知

zorder

浮动

参见

axvspan

在Axes上添加一个垂直跨度。

注释

备注

这是 axes.Axes.axhspanpyplot 包装器

使用 matplotlib.pyplot.axhspan 的示例#

绘制跨越一个轴的区域

Draw regions that span an Axes