Patch类及其子类¶
| 导入模块 | |
|---|---|
Patch父类¶
matplotlib.patches.Patch — Matplotlib 3.10.0 documentation
Hatch style reference — Matplotlib 3.10.1 documentation
- 参考坐标系
- 是否填充
- 填充色(facecolor/fc)
- 边框线型(linestyle/ls)
- 边框线宽(linewidth/lw)
- 边框线抗锯齿渲染(antialiased/aa)
- 边框线端点样式: 可选'butt'(默认), 'projecting', 'round'(FancyArrowPatch子类默认)
- 边框线转折样式: 可选'miter'(默认), 'round'(FancyArrowPatch子类默认), 'bevel'
- 框内线型:可选'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*',可组合重复
- 框内线宽
- 边框线及框内线色(edgecolor/ec)
- 覆盖facecolor和edgecolor
- 透明度
- 标签(用于图例)
- group id
- 是否可见
- 绘制优先级:值越低越优先
- 强制栅格化(bitmap)绘图以进行矢量图形输出
- 是否包含在layout计算中
Rectangle子类¶
matplotlib.patches.Rectangle — Matplotlib 3.10.1 documentation
通过锚点 xy 及其width和height定义的矩形。矩形在 x 方向上从 xy[0] 延伸到 xy[0] + width ,在 y 方向上从 xy[1] 延伸到 xy[1] + height 。可以将 xy 视为左下角,但 xy 实际上是哪个角取决于轴的方向和宽度和高度的符号;例如,如果 x 轴被反转或宽度为负,则 xy 将是右下角。
- 左下角锚点坐标(具体取决于axis的方向以及width、height参数的正负)
- 宽度
- 高度
- 参考坐标系
- 旋转中心坐标:可选'xy'(默认), 'center', 坐标(x, y)
- 绕旋转中心逆时针旋转角度(°)
Polygon子类¶
matplotlib.patches.Polygon — Matplotlib 3.10.1 documentation
- 多边形节点坐标数组
- 是否绘制封闭线
Wedge子类¶
matplotlib.patches.Wedge — Matplotlib 3.10.1 documentation
一个以 x, y (center)为中心,半径为r的扇形,从theta1逆时针扫到theta2(以°为单位)。如果给出了width,则从内径r-width到外径r绘制部分扇形。
- 扇形中心
- 半径
- 起始角度
- 终止角度
- 宽度
Shadow子类¶
matplotlib.patches.Shadow — Matplotlib 3.10.1 documentation
创建给定补丁的阴影。默认情况下,阴影将与补丁具有相同的面颜色,但会变暗。可以通过 shade 参数控制暗度。
- 待创建阴影的补丁
- 数据坐标中阴影的偏移量,按 dpi/72 的比例缩放
- 数据坐标中阴影的偏移量,按 dpi/72 的比例缩放
- 阴影的深浅与原始颜色之间的关系。如果为 1,则阴影为黑色;如果为 0,则阴影与补丁颜色相同
StepPatch子类¶
matplotlib.patches.StepPatch — Matplotlib 3.10.1 documentation
FancyBboxPatch子类¶
matplotlib.patches.FancyBboxPatch — Matplotlib 3.10.0 documentation
matplotlib.patches.BoxStyle — Matplotlib 3.10.0 documentation
Drawing fancy boxes — Matplotlib 3.10.1 documentation
"square, pad=0.3" == BoxStyle.Square(pad=0.3) == BoxStyle("square", pad=0.3) == BoxStyle("square, pad=0.3")
| BoxStyle子类 | 名称 | 属性 |
|---|---|---|
BoxStyle.Square() |
"square" |
pad=0.3 |
BoxStyle.Circle() |
"circle" |
|
BoxStyle.Ellipse() |
"ellipse" |
|
BoxStyle.LArrow() |
"larrow" |
|
BoxStyle.RArrow() |
"rarrow" |
|
BoxStyle.DArrow() |
"darrow" |
|
BoxStyle.Round() |
"round" |
pad=0.3, rounding_size=pad |
BoxStyle.Round4() |
"round4" |
pad=0.3, rounding_size=pad/2 |
BoxStyle.Sawtooth() |
"sawtooth" |
pad=0.3, tooth_size=pad/2 |
BoxStyle.Roundtooth() |
"roundtooth" |
- 左下角坐标
- 宽度
- 高度
- 参考坐标系统
- fancy box类型及属性
FancyArrowPatch子类¶
matplotlib.patches.FancyArrowPatch — Matplotlib 3.10.0 documentation
matplotlib.patches.ArrowStyle — Matplotlib 3.10.0 documentation
matplotlib.patches.ConnectionStyle — Matplotlib 3.10.0 documentation
"|-|, widthA=20, widthB=20, angleA=45, angleB=45" == ArrowStyle("|-|, widthA=20, widthB=20, angleA=45, angleB=45") == ArrowStyle("|-|", widthA=20, widthB=20, angleA=45, angleB=45) == ArrowStyle.BarAB(widthA=20, widthB=20, angleA=45, angleB=45)
| ArrowStyle子类 | 名称 | 属性 |
|---|---|---|
ArrowStyle.Curve() |
"-" |
None |
ArrowStyle.CurveA() |
"<-" |
head_length=0.4, head_width=0.2, widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0, scaleA=mutation_size, scaleB=mutation_size |
ArrowStyle.CurveB() |
"->" |
|
ArrowStyle.CurveAB() |
"<->" |
|
ArrowStyle.CurveFilledA() |
"<|-" |
|
ArrowStyle.CurveFilledB() |
"-|>" |
|
ArrowStyle.CurveFilledAB() |
"<|-|>" |
|
ArrowStyle.BracketA() |
"]-" |
widthA=1.0, widthB=1.0, lengthA=0.2, lengthB=0.2, angleA=0, angleB=0 |
ArrowStyle.BracketB() |
"-[" |
|
ArrowStyle.BracketAB() |
"]-[" |
|
ArrowStyle.BarAB() |
"|-|" |
widthA=1.0, widthB=1.0, angleA=0, angleB=0 |
ArrowStyle.BracketCurve() |
"]->" |
widthA=1.0, lengthA=0.2, angleA=0 |
ArrowStyle.CurveBracket() |
"<-[" |
widthB=1.0, lengthB=0.2, angleB=0 |
ArrowStyle.Simple() |
"simple"(默认) |
head_length=0.5, head_width=0.5, tail_width=0.2 |
ArrowStyle.Fancy() |
"fancy" |
head_length=0.4, head_width=0.4, tail_width=0.4 |
ArrowStyle.Wedge() |
"wedge" |
tail_width=0.3, shrink_factor=0.5 |
"arc3, rad=1" == ConnectionStyle("arc3, rad=1") == ConnectionStyle("arc3", rad=1) == ConnectionStyle.Arc3(rad=1)
| ConnectionStyle子类 | 名称 | 属性 |
|---|---|---|
ConnectionStyle.Arc3() |
"arc3"(默认) |
rad=0.0 |
ConnectionStyle.Arc() |
"arc" |
angleA=0, angleB=0, armA=None, armB=None, rad=0.0 |
ConnectionStyle.Angle3() |
"angle3" |
angleA=90, angleB=0 |
ConnectionStyle.Angle() |
"angle" |
angleA=90, angleB=0, rad=0.0 |
ConnectionStyle.Bar() |
"bar" |
armA=0.0, armB=0.0, fraction=0.3, angle=None |
- 路径
- 箭样式
- 连接线样式
- 箭尾坐标
- 箭头坐标
- 箭样式
- 连接线样式
- 箭尾Patch
- 箭头Patch
- 箭尾缩短
- 箭头缩短











