matplotlib.patches.FancyBboxPatch#
- class matplotlib.patches.FancyBboxPatch(xy, width, height, boxstyle='round', *, mutation_scale=1, mutation_aspect=1, **kwargs)[source]#
Bases:
PatchA fancy box around a rectangle with lower left at xy = (x, y) with specified width and height.
FancyBboxPatchis similar toRectangle, 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 inBoxStyle.- Parameters:
- xy(float, float)
The lower left corner of the box.
- widthfloat
The width of the box.
- heightfloat
The height of the box.
- boxstylestr or
BoxStyle The style of the fancy box. This can either be a
BoxStyleinstance or a string of the style name and optionally comma separated attributes (e.g. "Round, pad=0.2"). This string is passed toBoxStyleto construct aBoxStyleobject. See there for a full documentation.The following box styles are available:
Class
Name
Attrs
Square
squarepad=0.3
Circle
circlepad=0.3
Ellipse
ellipsepad=0.3
LArrow
larrowpad=0.3
RArrow
rarrowpad=0.3
DArrow
darrowpad=0.3
Round
roundpad=0.3, rounding_size=None
Round4
round4pad=0.3, rounding_size=None
Sawtooth
sawtoothpad=0.3, tooth_size=None
Roundtooth
roundtoothpad=0.3, tooth_size=None
- mutation_scalefloat, default: 1
Scaling factor applied to the attributes of the box style (e.g. pad or rounding_size).
- mutation_aspectfloat, default: 1
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.
- Other Parameters:
- **kwargs
Patchproperties Property
Description
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array and two offsets from the bottom left corner of the image
unknown
bool
antialiasedoraabool or None
CapStyleor {'butt', 'projecting', 'round'}BboxBaseor Nonebool
Patch or (Path, Transform) or None
color or None
color or None
bool
str
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
unknown
bool
JoinStyleor {'miter', 'round', 'bevel'}object
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
float or None
bool
list of
AbstractPathEffectNone or bool or float or callable
bool
(scale: float, length: float, randomness: float)
bool or None
str
bool
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>, hatch_linewidth=<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>)[source]#
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 and two offsets from the bottom left corner of the image
float or None
bool
antialiasedoraabool or None
unknown
[ 'square' | 'circle' | 'ellipse' | 'larrow' | 'rarrow' | 'darrow' | 'round' | 'round4' | 'sawtooth' | 'roundtooth' ]
CapStyleor {'butt', 'projecting', 'round'}BboxBaseor Nonebool
Patch or (Path, Transform) or None
color or None
color or None
bool
str
{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
unknown
float
bool
JoinStyleor {'miter', 'round', 'bevel'}object
{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
float or None
bool
float
float
list of
AbstractPathEffectNone or bool or float or callable
bool
(scale: float, length: float, randomness: float)
bool or None
str
bool
float
float
float
float
- set_bounds(*args)[source]#
Set the bounds of the rectangle.
Call signatures:
set_bounds(left, bottom, width, height) set_bounds((left, bottom, width, height))
- Parameters:
- left, bottomfloat
The coordinates of the bottom left corner of the rectangle.
- width, heightfloat
The width/height of the rectangle.
- set_boxstyle(boxstyle=None, **kwargs)[source]#
Set the box style, possibly with further 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.- Parameters:
- boxstylestr or
BoxStyle The style of the box: either a
BoxStyleinstance, or a string, which is the style name and optionally comma separated attributes (e.g. "Round,pad=0.2"). Such a string is used to construct aBoxStyleobject, as documented in that class.The following box styles are available:
Class
Name
Attrs
Square
squarepad=0.3
Circle
circlepad=0.3
Ellipse
ellipsepad=0.3
LArrow
larrowpad=0.3
RArrow
rarrowpad=0.3
DArrow
darrowpad=0.3
Round
roundpad=0.3, rounding_size=None
Round4
round4pad=0.3, rounding_size=None
Sawtooth
sawtoothpad=0.3, tooth_size=None
Roundtooth
roundtoothpad=0.3, tooth_size=None
- **kwargs
Additional attributes for the box style. See the table above for supported parameters.
- boxstylestr or
Examples
set_boxstyle("Round,pad=0.2") set_boxstyle("round", pad=0.2)