The OffsetBox is a simple container artist. The child artist are meant to be drawn at a relative position to its parent. The [VH]Packer, DrawingArea and TextArea are derived from the OffsetBox.
The [VH]Packer automatically adjust the relative postisions of their children, which should be instances of the OffsetBox. This is used to align similar artists together, e.g., in legend.
The DrawingArea can contain any Artist as a child. The DrawingArea has a fixed width and height. The position of children relative to the parent is fixed. The TextArea is contains a single Text instance. The width and height of the TextArea instance is the width and height of the its child text.
Bases: matplotlib.offsetbox.OffsetBox
An offset box placed according to the legend location loc. AnchoredOffsetbox has a single child. When multiple children is needed, use other OffsetBox class to enclose them. By default, the offset box is anchored against its parent axes. You may explicitly specify the bbox_to_anchor.
loc is a string or an integer specifying the legend location. The valid location codes are:
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right' : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center' : 10,
borderpad : pad between offsetbox frame and the bbox_to_anchor,
child : OffsetBox instance that will be anchored.
prop : font property. This is only used as a reference for paddings.
frameon : draw a frame box if True.
bbox_to_anchor : bbox to anchor. Use self.axes.bbox if None.
bbox_transform : with which the bbox_to_anchor will be transformed.
draw the artist
return the bbox that the legend will be anchored
return the child
return the list of children
return the extent of the artist. The extent of the child added with the pad is returned
get the bounding box in display space.
set the bbox that the child will be anchored.
bbox can be a Bbox instance, a list of [left, bottom, width, height], or a list of [left, bottom] where the width and height will be assumed to be zero. The bbox will be transformed to display coordinate by the given transform.
set the child to be anchored
Bases: matplotlib.offsetbox.AnchoredOffsetbox
AnchoredOffsetbox with Text.
Parameters: | s : string
loc : str
pad : float, optional
borderpad : float, optional
prop : matplotlib.font_manager.FontProperties
|
---|
Notes
Other keyword parameters of AnchoredOffsetbox are also allowed.
Bases: matplotlib.artist.Artist, matplotlib.text._AnnotationBase
Annotation-like class, but with offsetbox instead of Text.
offsetbox : OffsetBox instance
other parameters are identical to that of Annotation.
Draw the Annotation object to the given renderer.
return fontsize in points
set fontsize in points
Update the pixel positions of the annotated point and the text.
Bases: matplotlib.offsetbox.OffsetBox
Offset Box with the aux_transform . Its children will be transformed with the aux_transform first then will be offseted. The absolute coordinate of the aux_transform is meaning as it will be automatically adjust so that the left-lower corner of the bounding box of children will be set to (0,0) before the offset transform.
It is similar to drawing area, except that the extent of the box is not predetermined but calculated from the window extent of its children. Furthermore, the extent of the children will be calculated in the transformed coordinate.
Draw the children
return offset of the container.
get the bounding box in display space.
set offset of the container.
Accept : tuple of x,y coordinate in disokay units.
set_transform is ignored.
Bases: matplotlib.offsetbox.DraggableBase
Bases: object
helper code for a draggable artist (legend, offsetbox) The derived class must override following two method.
- def saveoffset(self):
- pass
- def update_offset(self, dx, dy):
- pass
saveoffset is called when the object is picked for dragging and it is meant to save reference position of the artist.
Optionally you may override following two methods.
- def artist_picker(self, artist, evt):
- return self.ref_artist.contains(evt)
- def finalize_offset(self):
- pass
disconnect the callbacks
Bases: matplotlib.offsetbox.DraggableBase
Bases: matplotlib.offsetbox.OffsetBox
The DrawingArea can contain any Artist as a child. The DrawingArea has a fixed width and height. The position of children relative to the parent is fixed.
width, height : width and height of the container box. xdescent, ydescent : descent of the box in x- and y-direction.
Draw the children
Return with, height, xdescent, ydescent of box
return offset of the container.
get the bounding box in display space.
set offset of the container.
Accept : tuple of x,y cooridnate in disokay units.
set_transform is ignored.
Bases: matplotlib.offsetbox.PackerBase
The HPacker has its children packed horizontally. It automatically adjusts the relative positions of children at draw time.
Parameters: | pad : float, optional
sep : float, optional
width : float, optional height : float, optional
align : str
mode : str
|
---|
Notes
pad and sep need to given in points and will be scale with the renderer dpi, while width and height need to be in pixels.
update offset of children and return the extents of the box
Bases: matplotlib.artist.Artist
The OffsetBox is a simple container artist. The child artist are meant to be drawn at a relative position to its parent.
Update the location of children if necessary and draw them to the given renderer.
Return a list of artists it contains.
Return with, height, xdescent, ydescent of box
Get the offset
accepts extent of the box
Return a list of visible artists it contains.
get the bounding box in display space.
Set the height
accepts float
Set the offset
accepts x, y, tuple, or a callable object.
Set the width
accepts float
Bases: matplotlib.offsetbox.OffsetBox
Draw the children
return offset of the container.
get the bounding box in display space.
Bases: matplotlib.offsetbox.OffsetBox
Parameters: | pad : float, optional
sep : float, optional
width : float, optional height : float, optional
align : str, optional
mode : str, optional
|
---|
Notes
pad and sep need to given in points and will be scale with the renderer dpi, while width and height need to be in pixels.
Bases: matplotlib.offsetbox.OffsetBox
pad : boundary pad
Note
pad need to given in points and will be scale with the renderer dpi, while width and height need to be in pixels.
Update the location of children if necessary and draw them to the given renderer.
update offset of childrens and return the extents of the box
Bases: matplotlib.offsetbox.OffsetBox
The TextArea is contains a single Text instance. The text is placed at (0,0) with baseline+left alignment. The width and height of the TextArea instance is the width and height of the its child text.
Parameters: | s : str
textprops : FontProperties, optional multilinebaseline : bool, optional
minimumdescent : bool, optional
|
---|
Draw the children
get minimumdescent.
get multilinebaseline .
return offset of the container.
get text
get the bounding box in display space.
Set minimumdescent .
If True, extent of the single line text is adjusted so that it has minimum descent of “p”
Set multilinebaseline .
If True, baseline for multiline text is adjusted so that it is (approximatedly) center-aligned with singleline text.
set offset of the container.
Accept : tuple of x,y coordinates in display units.
set text
set_transform is ignored.
Bases: matplotlib.offsetbox.PackerBase
The VPacker has its children packed vertically. It automatically adjust the relative positions of children in the drawing time.
Parameters: | pad : float, optional
sep : float, optional
width : float, optional height : float, optional
align : str, optional
mode : str, optional
|
---|
Notes
pad and sep need to given in points and will be scale with the renderer dpi, while width and height need to be in pixels.
update offset of childrens and return the extents of the box