matplotlib.patches.FancyBboxPatch#
- class matplotlib.patches.FancyBboxPatch(xy, width, height, boxstyle='round', *, mutation_scale=1, mutation_aspect=1, **kwargs)[源代码][源代码]#
基类:
Patch
围绕一个矩形的装饰框,左下角位于 xy = (x, y),具有指定的宽度和高度。
FancyBboxPatch
类似于Rectangle
,但它会在矩形周围绘制一个花哨的边框。矩形框到花哨边框的转换由BoxStyle
中定义的样式类处理。- 参数:
- xy(浮点数, 浮点数)
盒子的左下角。
- 宽度float
盒子的宽度。
- 高度float
盒子的高度。
- boxstyle : str 或
BoxStyle
字符串或 花式框的样式。这可以是
BoxStyle
实例,也可以是样式名称和可选的逗号分隔属性的字符串(例如,“Round, pad=0.2”)。此字符串传递给BoxStyle
以构造一个BoxStyle
对象。有关完整文档,请参阅该部分。以下是可用的框样式:
类
名称
Attrs
正方形
square
pad=0.3
圆
circle
pad=0.3
椭圆
ellipse
pad=0.3
L箭头
larrow
pad=0.3
RArrow
rarrow
pad=0.3
DArrow
darrow
pad=0.3
圆
round
pad=0.3, rounding_size=None
第四轮
round4
pad=0.3, rounding_size=None
锯齿
sawtooth
pad=0.3, tooth_size=None
圆齿
roundtooth
pad=0.3, tooth_size=None
- mutation_scalefloat, 默认值: 1
应用于盒子样式属性的缩放因子(例如,填充或圆角大小)。
- mutation_aspectfloat, 默认值: 1
矩形的高度将在突变前被此值压缩,而突变后的盒子将被其倒数拉伸。例如,这允许不同的水平和垂直填充。
- 其他参数:
- **kwargs :
Patch
属性补丁属性 属性
描述
一个过滤函数,它接收一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组和两个从图像左下角开始的偏移量
未知
布尔
抗锯齿
或 aa布尔值或无
CapStyle
或 {'butt', 'projecting', 'round'}BboxBase
或 None布尔
补丁或(路径,变换)或无
edgecolor
或 eccolor or None
facecolor
或 fccolor or None
布尔
str
{'/', '', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
布尔
JoinStyle
或 {'miter', 'round', 'bevel'}对象
linestyle
或 ls{'-', '--', '-.', ':', '', (偏移, 开关序列), ...}
linewidth
或 lw浮点数或无
布尔
None 或 bool 或 float 或 callable
布尔
(scale: float, length: float, randomness: float)
布尔值或无
str
布尔
float
- **kwargs :
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, bounds=<UNSET>, boxstyle=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, height=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, mouseover=<UNSET>, mutation_aspect=<UNSET>, mutation_scale=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, x=<UNSET>, y=<UNSET>, zorder=<UNSET>)[源代码]#
一次性设置多个属性。
支持的属性是
属性
描述
一个过滤函数,它接收一个 (m, n, 3) 浮点数组和一个 dpi 值,并返回一个 (m, n, 3) 数组和两个从图像左下角开始的偏移量
标量或无
布尔
抗锯齿
或 aa布尔值或无
未知
[ 'square' | 'circle' | 'ellipse' | 'larrow' | 'rarrow' | 'darrow' | 'round' | 'round4' | 'sawtooth' | 'roundtooth' ]
CapStyle
或 {'butt', 'projecting', 'round'}BboxBase
或 None布尔
补丁或(路径,变换)或无
edgecolor
或 eccolor or None
facecolor
或 fccolor or None
布尔
str
{'/', '', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
float
布尔
JoinStyle
或 {'miter', 'round', 'bevel'}对象
linestyle
或 ls{'-', '--', '-.', ':', '', (偏移, 开关序列), ...}
linewidth
或 lw浮点数或无
布尔
float
float
None 或 bool 或 float 或 callable
布尔
(scale: float, length: float, randomness: float)
布尔值或无
str
布尔
float
float
float
float
- set_bounds(*args)[源代码][源代码]#
设置矩形的边界。
调用签名:
set_bounds(left, bottom, width, height) set_bounds((left, bottom, width, height))
- 参数:
- 左, 底float
矩形左下角的坐标。
- 宽度, 高度float
矩形的宽度/高度。
- set_boxstyle(boxstyle=None, **kwargs)[源代码][源代码]#
设置框样式,可能带有进一步的属性。
不会重复使用前一个框样式中的属性。
没有参数(或使用
boxstyle=None
),可用的框样式将作为人类可读的字符串返回。- 参数:
- boxstyle : str 或
BoxStyle
字符串或 盒子的样式:可以是
BoxStyle
实例,或是一个字符串,该字符串是样式名称,并且可以选择性地以逗号分隔属性(例如,"Round,pad=0.2")。这样的字符串用于构造BoxStyle
对象,如该类文档中所述。以下是可用的框样式:
类
名称
Attrs
正方形
square
pad=0.3
圆
circle
pad=0.3
椭圆
ellipse
pad=0.3
L箭头
larrow
pad=0.3
RArrow
rarrow
pad=0.3
DArrow
darrow
pad=0.3
圆
round
pad=0.3, rounding_size=None
第四轮
round4
pad=0.3, rounding_size=None
锯齿
sawtooth
pad=0.3, tooth_size=None
圆齿
roundtooth
pad=0.3, tooth_size=None
- **kwargs
盒样式的附加属性。请参阅上表以获取支持的参数。
- boxstyle : str 或
示例
set_boxstyle("Round,pad=0.2") set_boxstyle("round", pad=0.2)