matplotlib.patches.FancyBboxPatch¶
-
class
matplotlib.patches.FancyBboxPatch(xy, width, height, boxstyle='round', bbox_transmuter=<deprecated parameter>, mutation_scale=1, mutation_aspect=1, **kwargs)[source]¶ Bases:
matplotlib.patches.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: - xyfloat, float
The lower left corner of the box.
- widthfloat
The width of the box.
- heightfloat
The height of the box.
- boxstylestr or
matplotlib.patches.BoxStyle The style of the fancy box. This can either be a
BoxStyleinstance or a string of the style name and optionally comma seprarated 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 Circle circlepad=0.3 DArrow darrowpad=0.3 LArrow larrowpad=0.3 RArrow rarrowpad=0.3 Round roundpad=0.3, rounding_size=None Round4 round4pad=0.3, rounding_size=None Roundtooth roundtoothpad=0.3, tooth_size=None Sawtooth sawtoothpad=0.3, tooth_size=None Square squarepad=0.3 - 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 agg_filtera filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alphafloat or None animatedbool antialiasedor aaunknown capstyle{'butt', 'round', 'projecting'} clip_boxBboxclip_onbool clip_pathPatch or (Path, Transform) or None colorcolor containsunknown edgecoloror eccolor or None or 'auto' facecoloror fccolor or None figureFigurefillbool gidstr hatch{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} in_layoutbool joinstyle{'miter', 'round', 'bevel'} labelobject linestyleor ls{'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidthor lwfloat or None path_effectsAbstractPathEffectpickerNone or bool or callable rasterizedbool or None sketch_params(scale: float, length: float, randomness: float) snapbool or None transformTransformurlstr visiblebool zorderfloat
-
__init__(xy, width, height, boxstyle='round', bbox_transmuter=<deprecated parameter>, mutation_scale=1, mutation_aspect=1, **kwargs)[source]¶ Parameters: - xyfloat, float
The lower left corner of the box.
- widthfloat
The width of the box.
- heightfloat
The height of the box.
- boxstylestr or
matplotlib.patches.BoxStyle The style of the fancy box. This can either be a
BoxStyleinstance or a string of the style name and optionally comma seprarated 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 Circle circlepad=0.3 DArrow darrowpad=0.3 LArrow larrowpad=0.3 RArrow rarrowpad=0.3 Round roundpad=0.3, rounding_size=None Round4 round4pad=0.3, rounding_size=None Roundtooth roundtoothpad=0.3, tooth_size=None Sawtooth sawtoothpad=0.3, tooth_size=None Square squarepad=0.3 - 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 agg_filtera filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alphafloat or None animatedbool antialiasedor aaunknown capstyle{'butt', 'round', 'projecting'} clip_boxBboxclip_onbool clip_pathPatch or (Path, Transform) or None colorcolor containsunknown edgecoloror eccolor or None or 'auto' facecoloror fccolor or None figureFigurefillbool gidstr hatch{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} in_layoutbool joinstyle{'miter', 'round', 'bevel'} labelobject linestyleor ls{'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidthor lwfloat or None path_effectsAbstractPathEffectpickerNone or bool or callable rasterizedbool or None sketch_params(scale: float, length: float, randomness: float) snapbool or None transformTransformurlstr visiblebool zorderfloat
-
__module__= 'matplotlib.patches'¶
-
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.
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.Parameters: - boxstylestr or
matplotlib.patches.BoxStyle The style of the fancy box. This can either be a
BoxStyleinstance or a string of the style name and optionally comma seprarated 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 Circle circlepad=0.3 DArrow darrowpad=0.3 LArrow larrowpad=0.3 RArrow rarrowpad=0.3 Round roundpad=0.3, rounding_size=None Round4 round4pad=0.3, rounding_size=None Roundtooth roundtoothpad=0.3, tooth_size=None Sawtooth sawtoothpad=0.3, tooth_size=None Square squarepad=0.3 - **kwargs
Additional attributes for the box style. See the table above for supported parameters.
Examples
set_boxstyle("round,pad=0.2") set_boxstyle("round", pad=0.2)
- boxstylestr or