On this page
matplotlib.patches.FancyBboxPatch
class matplotlib.patches.FancyBboxPatch(xy, width, height, boxstyle='round', bbox_transmuter=None, mutation_scale=1.0, mutation_aspect=None, **kwargs)[source]-
Bases:
matplotlib.patches.PatchDraw a fancy box around a rectangle with lower left at xy*=(*x, y) with specified width and height.
FancyBboxPatchclass is similar toRectangleclass, but it draws a fancy box around the rectangle. The transformation of the rectangle box to the fancy box is delegated to theBoxTransmuterBaseand its derived classes.xy = lower left corner
width, height
boxstyle determines what kind of fancy box will be drawn. It can be a string of the style name with a comma separated attribute, or an instance of
BoxStyle. 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_scale : a value with which attributes of boxstyle (e.g., pad) will be scaled. default=1.
mutation_aspect : 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. default=None.
Valid kwargs are:
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 antialiasedunknown capstyle{'butt', 'round', 'projecting'} clip_boxBboxclip_onbool clip_path[( Path,Transform) |Patch| None]colorcolor containscallable edgecolorcolor or None or 'auto' facecolorcolor or None figureFigurefillbool gidstr hatch{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'} in_layoutbool joinstyle{'miter', 'round', 'bevel'} labelobject linestyle{'-', '--', '-.', ':', '', (offset, on-off-seq), ...} linewidthfloat or None for default path_effectsAbstractPathEffectpickerNone or bool or float or callable rasterizedbool or None sketch_params(scale: float, length: float, randomness: float) snapbool or None transformTransformurlstr visiblebool zorderfloat get_bbox()[source]
get_boxstyle()[source]-
Return the boxstyle object
get_height()[source]-
Return the height of the rectangle
get_mutation_aspect()[source]-
Return the aspect ratio of the bbox mutation.
get_mutation_scale()[source]-
Return the mutation scale.
get_path()[source]-
Return the mutated path of the rectangle
get_width()[source]-
Return the width of the rectangle
get_x()[source]-
Return the left coord of the rectangle
get_y()[source]-
Return the bottom coord of the rectangle
set_bounds(*args)[source]-
Set the bounds of the rectangle: l,b,w,h
ACCEPTS: (left, bottom, width, height)
set_boxstyle(boxstyle=None, **kw)[source]-
Set the box style.
boxstyle can be a string with boxstyle name with optional comma-separated attributes. Alternatively, the attrs can be provided as keywords:
set_boxstyle("round,pad=0.2") set_boxstyle("round", pad=0.2)Old attrs simply are forgotten.
Without argument (or with boxstyle = None), it returns available box styles.
The following boxstyles 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 ACCEPTS: [ 'circle' | 'darrow' | 'larrow' | 'rarrow' | 'round' | 'round4' | 'roundtooth' | 'sawtooth' | 'square' ]
set_height(h)[source]-
Set the rectangle height.
Parameters: -
h : float
-
set_mutation_aspect(aspect)[source]-
Set the aspect ratio of the bbox mutation.
Parameters: -
aspect : float
-
set_mutation_scale(scale)[source]-
Set the mutation scale.
Parameters: -
scale : float
-
set_width(w)[source]-
Set the rectangle width.
Parameters: -
w : float
-
set_x(x)[source]-
Set the left coord of the rectangle.
Parameters: -
x : float
-
set_y(y)[source]-
Set the bottom coord of the rectangle.
Parameters: -
y : float
-
Examples using matplotlib.patches.FancyBboxPatch
© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.0.0/api/_as_gen/matplotlib.patches.FancyBboxPatch.html