matplotlib.patches.Arrow#

class matplotlib.patches.Arrow(x, y, dx, dy, *, width=1.0, **kwargs)[source]#

基类:Patch

一个箭头补丁。

从 (x, y) 绘制一个箭头到 (x + dx, y + dy)。箭头的宽度由 width 缩放。

参数:
x浮点数

箭头尾部的x坐标。

y浮点数

箭头尾部的y坐标。

dxfloat

箭头在x方向的长度。

dyfloat

箭头在y方向的长度。

widthfloat, 默认值: 1

箭头的宽度缩放因子。默认值为1时,尾部宽度为0.2,头部宽度为0.6。

**kwargs

关键字参数控制 Patch 属性

属性

描述

agg_filter

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

alpha

未知

animated

布尔值

antialiasedaa

布尔值或 None

capstyle

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

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

color

color

edgecolorec

颜色 或 None

facecolorfc

颜色 或 None

figure

FigureSubFigure

fill

布尔值

gid

str

hatch

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

hatch_linewidth

未知

in_layout

布尔值

joinstyle

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

label

object

linestylels

{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}

linewidthlw

浮点数或 None

mouseover

布尔值

path_effects

AbstractPathEffect 列表

picker

None 或 布尔值 或 浮点数 或 可调用对象

rasterized

布尔值

sketch_params

(scale: 浮点数, length: 浮点数, randomness: 浮点数)

snap

布尔值或 None

transform

变换

url

str

visible

布尔值

zorder

浮点数

另请参阅

FancyArrow

允许独立控制头部和尾部属性的补丁。

get_patch_transform()[source]#

返回将补丁坐标映射到数据坐标的 Transform 实例。

例如,可以通过提供单位圆的坐标,并使用一个将坐标(补丁坐标)缩放5倍的变换,来定义一个表示半径为5的圆形补丁。

get_path()[source]#

返回此补丁的路径。

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, data=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, hatch_linewidth=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]#

一次性设置多个属性。

支持的属性包括:

属性

描述

agg_filter

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

alpha

浮点数或 None

animated

布尔值

antialiasedaa

布尔值或 None

capstyle

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

clip_box

BboxBase 或 None

clip_on

布尔值

clip_path

Patch 或 (Path, Transform) 或 None

color

color

data

未知

edgecolorec

颜色 或 None

facecolorfc

颜色 或 None

figure

FigureSubFigure

fill

布尔值

gid

str

hatch

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

hatch_linewidth

未知

in_layout

布尔值

joinstyle

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

label

object

linestylels

{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}

linewidthlw

浮点数或 None

mouseover

布尔值

path_effects

AbstractPathEffect 列表

picker

None 或 布尔值 或 浮点数 或 可调用对象

rasterized

布尔值

sketch_params

(scale: 浮点数, length: 浮点数, randomness: 浮点数)

snap

布尔值或 None

transform

变换

url

str

visible

布尔值

zorder

浮点数

set_data(x=None, y=None, dx=None, dy=None, width=None)[source]#

设置 Arrow 的 x, y, dx, dy 和 width。值为 None 的将不会被更新。

参数:
x, yfloat 或 None, 默认值: None

箭头底部的 x 和 y 坐标。

dx, dyfloat 或 None, 默认值: None

箭头沿 x 和 y 方向的长度。

widthfloat 或 None, 默认值: None

完整箭头尾部的宽度。

使用 matplotlib.patches.Arrow 的示例#

箭头指南

箭头指南

Matplotlib 艺术家参考

Matplotlib 艺术家参考