matplotlib.patches.Rectangle#
- class matplotlib.patches.Rectangle(xy, width, height, *, angle=0.0, rotation_point='xy', **kwargs)[源代码][源代码]#
基类:
Patch
通过锚点 xy 及其 宽度 和 高度 定义的矩形。
矩形从
xy[0]
延伸到xy[0] + width
在 x 方向上,从xy[1]
延伸到xy[1] + height
在 y 方向上。: +------------------+ : | | : height | : | | : (xy)---- width -----+
可以将 xy 想象为左下角,但 xy 实际上是哪个角取决于轴的方向和 width 及 height 的符号;例如,如果 x 轴反转或 width 为负,xy 将是右下角。
- 参数:
- xy(浮点数, 浮点数)
锚点。
- 宽度float
矩形的宽度。
- 高度float
矩形高度。
- 角度float, 默认值: 0
围绕旋转点逆时针旋转的度数。
- 旋转点{'xy', 'center', (number, number)}, 默认: 'xy'
如果
'xy'
,围绕锚点旋转。如果'center'
,围绕中心旋转。如果是两个数字的元组,围绕这个坐标旋转。
- 其他参数:
- **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 :
- get_patch_transform()[源代码][源代码]#
返回将补丁坐标映射到数据坐标的
Transform
实例。例如,可以通过提供单位圆的坐标和将坐标(补丁坐标)缩放5倍的变换来定义一个表示半径为5的圆的补丁。
- property rotation_point#
补丁的旋转点。
- set(*, agg_filter=<UNSET>, alpha=<UNSET>, angle=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, bounds=<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>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, x=<UNSET>, xy=<UNSET>, y=<UNSET>, zorder=<UNSET>)[源代码]#
一次性设置多个属性。
支持的属性是
属性
描述
一个过滤函数,该函数接收一个 (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
- set_bounds(*args)[源代码][源代码]#
将矩形的边界设置为 left、bottom、width、height。
这些值可以作为单独的参数传递,也可以作为一个元组传递:
set_bounds(left, bottom, width, height) set_bounds((left, bottom, width, height))
- property xy#
返回矩形的左下角坐标,作为元组。