matplotlib.patches.
FancyBboxPatch
(xy, width, height, boxstyle='round', bbox_transmuter=None, mutation_scale=1.0, mutation_aspect=None, **kwargs)¶Draw a fancy box around a rectangle with lower left at xy*=(*x, y) with specified width and height.
FancyBboxPatch
class is similar to Rectangle
class, but it draws a fancy box around the rectangle. The
transformation of the rectangle box to the fancy box is delegated
to the BoxTransmuterBase
and 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 circle
pad=0.3 DArrow darrow
pad=0.3 LArrow larrow
pad=0.3 RArrow rarrow
pad=0.3 Round round
pad=0.3,rounding_size=None Round4 round4
pad=0.3,rounding_size=None Roundtooth roundtooth
pad=0.3,tooth_size=None Sawtooth sawtooth
pad=0.3,tooth_size=None Square square
pad=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_filter
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array alpha
float or None animated
bool antialiased
or aabool or None capstyle
[‘butt’ | ‘round’ | ‘projecting’] clip_box
a Bbox
instanceclip_on
bool clip_path
[( Path
,Transform
) |Patch
| None]color
matplotlib color spec contains
a callable function edgecolor
or ecmpl color spec, None, ‘none’, or ‘auto’ facecolor
or fcmpl color spec, or None for default, or ‘none’ for no color figure
a Figure
instancefill
bool gid
an id string hatch
[‘/’ | ‘' | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle
[‘miter’ | ‘round’ | ‘bevel’] label
object linestyle
or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) | '-'
|'--'
|'-.'
|':'
|'None'
|' '
|''
]linewidth
or lwfloat or None for default path_effects
AbstractPathEffect
picker
[None | bool | float | callable] rasterized
bool or None sketch_params
(scale: float, length: float, randomness: float) snap
bool or None transform
Transform
url
a url string visible
bool zorder
float
get_bbox
()¶get_boxstyle
()¶Return the boxstyle object
get_height
()¶Return the height of the rectangle
get_mutation_aspect
()¶Return the aspect ratio of the bbox mutation.
get_mutation_scale
()¶Return the mutation scale.
get_path
()¶Return the mutated path of the rectangle
get_width
()¶Return the width of the rectangle
get_x
()¶Return the left coord of the rectangle
get_y
()¶Return the bottom coord of the rectangle
set_bounds
(*args)¶Set the bounds of the rectangle: l,b,w,h
ACCEPTS: (left, bottom, width, height)
set_boxstyle
(boxstyle=None, **kw)¶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 circle
pad=0.3 DArrow darrow
pad=0.3 LArrow larrow
pad=0.3 RArrow rarrow
pad=0.3 Round round
pad=0.3,rounding_size=None Round4 round4
pad=0.3,rounding_size=None Roundtooth roundtooth
pad=0.3,tooth_size=None Sawtooth sawtooth
pad=0.3,tooth_size=None Square square
pad=0.3
ACCEPTS: [ ‘circle’ | ‘darrow’ | ‘larrow’ | ‘rarrow’ | ‘round’ | ‘round4’ | ‘roundtooth’ | ‘sawtooth’ | ‘square’ ]
set_height
(h)¶Set the width rectangle
ACCEPTS: float
set_mutation_aspect
(aspect)¶Set the aspect ratio of the bbox mutation.
ACCEPTS: float
set_mutation_scale
(scale)¶Set the mutation scale.
ACCEPTS: float
set_width
(w)¶Set the width rectangle
ACCEPTS: float
set_x
(x)¶Set the left coord of the rectangle
ACCEPTS: float
set_y
(y)¶Set the bottom coord of the rectangle
ACCEPTS: float