matplotlib.axes.Axes.arrow#

Axes.arrow(x, y, dx, dy, **kwargs)[源代码][源代码]#

在 Axes 中添加一个箭头。

这将从 (x, y) 绘制一个箭头到 (x+dx, y+dy)

参数:
x, y浮动

箭头基点的 x 和 y 坐标。

dx, dy浮动

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

宽度float, 默认值: 0.001

完整箭头尾部的宽度。

length_includes_headbool, 默认: False

如果头部在计算长度时被计入,则为真。

head_widthfloat 或 None, 默认值: 3*width

完整箭头的总宽度。

head_lengthfloat 或 None, 默认值: 1.5 * head_width

箭头头部长度。

形状{'full', 'left', 'right'}, 默认: 'full'

绘制左半箭头、右半箭头或全箭头。

悬垂float, 默认值: 0

箭头向后扫掠的分数(0 悬垂表示三角形形状)。可以是负数或大于一。

head_starts_at_zerobool, 默认: False

如果为真,头部从坐标0开始绘制,而不是在坐标0结束。

**kwargs

Patch 属性:

属性

描述

agg_filter

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

alpha

未知

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

填充

布尔值

gid

str

hatch

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

in_layout

布尔值

joinstyle

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

标签

对象

线条样式 或 ls

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

linewidth 或 lw

浮点数或无

鼠标悬停

布尔值

路径效果

AbstractPathEffect 列表

picker

None 或 bool 或 float 或 callable

光栅化

布尔值

sketch_params

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

snap

布尔值或无

transform

Transform

url

str

可见

布尔值

zorder

浮动

返回:
FancyArrow

创建的 FancyArrow 对象。

注释

生成的箭头受 Axes 纵横比和限制的影响。这可能会产生一个箭头,其头部与茎不成直角。要创建一个头部与茎成直角的箭头,请使用 annotate() 例如:

>>> ax.annotate("", xy=(0.5, 0.5), xytext=(0, 0),
...             arrowprops=dict(arrowstyle="->"))

使用 matplotlib.axes.Axes.arrow 的示例#

Arrow 演示

Arrow Demo