matplotlib.pyplot.arrow#

matplotlib.pyplot.arrow(x, y, dx, dy, **kwargs)[source]#

[已弃用] 向 Axes 添加箭头。

此函数从 (x, y) 绘制一个箭头到 (x+dx, y+dy)

不建议使用

不建议使用此方法,因为它无法保证箭头能合理渲染。例如,最终的箭头会受到坐标轴长宽比和限制的影响,这可能会使箭头变形。

请考虑改用不带文本的 annotate,例如:

ax.annotate("", xytext=(0, 0), xy=(0.5, 0.5),
            arrowprops=dict(arrowstyle="->"))
参数:
x, y浮点数

箭头底部的 x 和 y 坐标。

dx, dy浮点数

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

width浮点数,默认值:0.001

完整箭头尾部的宽度。

length_includes_head布尔值,默认值:False

如果箭头头部计入长度计算,则为 True。

head_width浮点数或 None,默认值:3*width

完整箭头头部的总宽度。

head_length浮点数或 None,默认值:1.5*head_width

箭头头部的长度。

shape{'full'(完整), 'left'(左), 'right'(右)},默认值:'full'

绘制箭头的左半部分、右半部分或完整箭头。

overhang浮点数,默认值:0

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

head_starts_at_zero布尔值,默认值:False

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

**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

创建的 FancyArrow 对象。

备注

注意

这是 pyplot 包装器,对应于 axes.Axes.arrow