mpl_toolkits.axes_grid1.anchored_artists.AnchoredDrawingArea#

class mpl_toolkits.axes_grid1.anchored_artists.AnchoredDrawingArea(width, height, xdescent, ydescent, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs)[source]#

Bases: AnchoredOffsetbox

An anchored container with a fixed size and fillable DrawingArea.

Artists added to the drawing_area will have their coordinates interpreted as pixels. Any transformations set on the artists will be overridden.

Parameters:
width, heightfloat

Width and height of the container, in pixels.

xdescent, ydescentfloat

Descent of the container in the x- and y- direction, in pixels.

locstr

Location of this artist. Valid locations are 'upper left', 'upper center', 'upper right', 'center left', 'center', 'center right', 'lower left', 'lower center, 'lower right'. For backward compatibility, numeric values are accepted as well. See the parameter loc of Legend for details.

padfloat, default: 0.4

Padding around the child objects, in fraction of the font size.

borderpadfloat, default: 0.5

Border padding, in fraction of the font size.

propmatplotlib.font_manager.FontProperties, optional

Font property used as a reference for paddings.

frameonbool, default: True

If True, draw a box around this artists.

**kwargs

Keyword arguments forwarded to AnchoredOffsetbox.

Examples

To display blue and red circles of different sizes in the upper right of an Axes ax:

>>> ada = AnchoredDrawingArea(20, 20, 0, 0,
...                           loc='upper right', frameon=False)
>>> ada.drawing_area.add_artist(Circle((10, 10), 10, fc="b"))
>>> ada.drawing_area.add_artist(Circle((30, 10), 5, fc="r"))
>>> ax.add_artist(ada)
Attributes:
drawing_areamatplotlib.offsetbox.DrawingArea

A container for artists to display.

set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, bbox_to_anchor=<UNSET>, child=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, gid=<UNSET>, height=<UNSET>, in_layout=<UNSET>, label=<UNSET>, mouseover=<UNSET>, offset=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)[source]#

Set multiple properties at once.

Supported properties 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 and two offsets from the bottom left corner of the image

alpha

scalar or None

animated

bool

bbox_to_anchor

unknown

child

unknown

clip_box

Bbox

clip_on

bool

clip_path

Patch or (Path, Transform) or None

figure

Figure

gid

str

height

float

in_layout

bool

label

object

mouseover

bool

offset

(float, float) or callable

path_effects

AbstractPathEffect

picker

None or bool or float or callable

rasterized

bool

sketch_params

(scale: float, length: float, randomness: float)

snap

bool or None

transform

Transform

url

str

visible

bool

width

float

zorder

float

Examples using mpl_toolkits.axes_grid1.anchored_artists.AnchoredDrawingArea#

Simple Anchored Artists

Simple Anchored Artists

Simple Anchored Artists
Annotations

Annotations

Annotations