matplotlib.patches.PathPatch#

class matplotlib.patches.PathPatch(path, **kwargs)[源代码][源代码]#

基类:Patch

一个通用的多曲线路径补丁。

path 是一个 Path 对象。

有效的关键字参数是:

属性

描述

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

浮点数或无

鼠标悬停

布尔

path_effects

AbstractPathEffect 的列表

picker

None 或 bool 或 float 或 callable

光栅化

布尔

sketch_params

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

snap

布尔值或无

transform

Transform

url

str

可见

布尔

zorder

浮动

get_path()[源代码][源代码]#

返回此补丁的路径。

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<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=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<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

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

颜色

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

浮点数或无

鼠标悬停

布尔

路径

未知

path_effects

AbstractPathEffect 的列表

picker

None 或 bool 或 float 或 callable

光栅化

布尔

sketch_params

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

snap

布尔值或无

transform

Transform

url

str

可见

布尔

zorder

浮动

set_path(path)[源代码][源代码]#

使用 matplotlib.patches.PathPatch 的示例#

带有误差带的曲线

Curve with error band

楼梯演示

Stairs Demo

多种绘制图像的方法

Many ways to plot images

带有自定义填充颜色的箱形图

Box plots with custom fill colors

将文本用作路径

Using a text as a Path

Matplotlib 艺术家的参考

Reference for Matplotlib artists

复合路径

Compound path

海豚

Dolphins

Mmh 甜甜圈!!!

Mmh Donuts!!!

PathPatch 对象

PathPatch object

贝塞尔曲线

Bezier curve

Firefox

Firefox

路径编辑器

Path editor

使用矩形和多边形集合构建直方图

Building histograms using Rectangles and PolyCollections

Matplotlib 标志

Matplotlib logo

TickedStroke 路径效果

TickedStroke patheffect

在3D图中绘制平面物体

Draw flat objects in 3D plot

路径教程

Path Tutorial