Bases: matplotlib.patches.Patch
A fancy box around a rectangle with lower left at xy = (x, y) with specified width and height.
FancyBboxPatch
is similar to Rectangle
, but it draws a fancy box around the rectangle. The transformation of the rectangle box to the fancy box is delegated to the style classes defined in BoxStyle
.
The lower left corner of the box.
The width of the box.
The height of the box.
matplotlib.patches.BoxStyle
The style of the fancy box. This can either be a BoxStyle
instance or a string of the style name and optionally comma seprarated attributes (e.g. "Round, pad=0.2"). This string is passed to BoxStyle
to construct a BoxStyle
object. See there for a full documentation.
The following box styles are available:
Class | Name | Attrs |
---|---|---|
Square |
| pad=0.3 |
Circle |
| pad=0.3 |
LArrow |
| pad=0.3 |
RArrow |
| pad=0.3 |
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 |
Scaling factor applied to the attributes of the box style (e.g. pad or rounding_size).
The height of the rectangle will be squeezed by this value before the mutation and the mutated box will be stretched by the inverse of it. For example, this allows different horizontal and vertical padding.
Patch
properties
Property | Description |
---|---|
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array | |
unknown | |
bool | |
| bool or None |
| |
bool | |
Patch or (Path, Transform) or None | |
color | |
| color or None |
| color or None |
bool | |
str | |
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} | |
bool | |
| |
object | |
| {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} |
| float or None |
None or bool or float or callable | |
bool | |
(scale: float, length: float, randomness: float) | |
bool or None | |
str | |
bool | |
float |
Return the boxstyle object.
Return the height of the rectangle.
Return the aspect ratio of the bbox mutation.
Return the mutation scale.
Return the mutated path of the rectangle.
Return the width of the rectangle.
Return the left coord of the rectangle.
Return the bottom coord of the rectangle.
Set multiple properties at once.
Supported properties are
Property | Description |
---|---|
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array | |
scalar or None | |
bool | |
| bool or None |
unknown | |
[ 'square' | 'circle' | 'larrow' | 'rarrow' | 'darrow' | 'round' | 'round4' | 'sawtooth' | 'roundtooth' ] | |
| |
bool | |
Patch or (Path, Transform) or None | |
color | |
| color or None |
| color or None |
bool | |
str | |
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} | |
float | |
bool | |
| |
object | |
| {'-', '--', '-.', ':', '', (offset, on-off-seq), ...} |
| float or None |
float | |
float | |
None or bool or float or callable | |
bool | |
(scale: float, length: float, randomness: float) | |
bool or None | |
str | |
bool | |
float | |
float | |
float | |
float |
Set the bounds of the rectangle.
Call signatures:
set_bounds(left, bottom, width, height) set_bounds((left, bottom, width, height))
The coordinates of the bottom left corner of the rectangle.
The width/height of the rectangle.
Set the box style.
Most box styles can be further configured using attributes. Attributes from the previous box style are not reused.
Without argument (or with boxstyle=None
), the available box styles are returned as a human-readable string.
matplotlib.patches.BoxStyle
The style of the fancy box. This can either be a BoxStyle
instance or a string of the style name and optionally comma seprarated attributes (e.g. "Round, pad=0.2"). This string is passed to BoxStyle
to construct a BoxStyle
object. See there for a full documentation.
The following box styles are available:
Class | Name | Attrs |
---|---|---|
Square |
| pad=0.3 |
Circle |
| pad=0.3 |
LArrow |
| pad=0.3 |
RArrow |
| pad=0.3 |
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 |
Additional attributes for the box style. See the table above for supported parameters.
set_boxstyle("round,pad=0.2") set_boxstyle("round", pad=0.2)
Set the rectangle height.
Set the aspect ratio of the bbox mutation.
Set the mutation scale.
Set the rectangle width.
Set the left coord of the rectangle.
Set the bottom coord of the rectangle.
matplotlib.patches.FancyBboxPatch
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/matplotlib.patches.FancyBboxPatch.html