matplotlib.patches.FancyArrow#

class matplotlib.patches.FancyArrow(x, y, dx, dy, *, width=0.001, length_includes_head=False, head_width=None, head_length=None, shape='full', overhang=0, head_starts_at_zero=False, **kwargs)[源代码][源代码]#

基类:Polygon

类似于箭头,但允许您独立设置箭头的宽度和高度。

参数:
x, y浮动

箭头基点的 x 和 y 坐标。

dx, dy浮动

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

宽度float, 默认值: 0.001

完整箭头尾部的宽度。

length_includes_headbool, 默认值: False

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

head_width浮点数或无, 默认值: 3*宽度

完整箭头的总宽度。

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

浮动

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, closed=<UNSET>, color=<UNSET>, data=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<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>, xy=<UNSET>, zorder=<UNSET>)[源代码]#

一次性设置多个属性。

支持的属性有

属性

描述

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

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

closed

布尔

颜色

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

可见

布尔

xy

(N, 2) 数组类

zorder

浮动

set_data(*, x=None, y=None, dx=None, dy=None, width=None, head_width=None, head_length=None)[源代码][源代码]#

设置 FancyArrow 的 x, y, dx, dy, width, head_width 和 head_length。未设置的值将不会被更新。

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

箭头基点的 x 和 y 坐标。

dx, dyfloat 或 None, 默认: None

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

宽度float 或 None, 默认: None

完整箭头尾部的宽度。

head_widthfloat 或 None, 默认: None

完整箭头的总宽度。

head_lengthfloat 或 None, 默认: None

箭头头部长度。

使用 matplotlib.patches.FancyArrow 的示例#

Arrow 指南

Arrow guide