Bases: matplotlib.offsetbox.AnchoredOffsetbox
Draw a horizontal scale bar with a center-aligned label underneath.
matplotlib.transforms.Transform
The transformation object for the coordinate system in use, i.e., matplotlib.axes.Axes.transData
.
Horizontal length of the size bar, given in coordinates of transform.
Label to display.
Location of this ellipse. 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.
Padding around the label and size bar, in fraction of the font size.
Border padding, in fraction of the font size.
Separation between the label and the size bar, in points.
If True, draw a box around the horizontal bar and label.
Vertical length of the size bar, given in coordinates of transform.
Color for the size bar and label.
If True, the label will be over the size bar.
matplotlib.font_manager.FontProperties
, optional
Font properties for the label text.
If True and if size_vertical is nonzero, the size bar will be filled in with the color specified by the size bar. Defaults to True if size_vertical is greater than zero and False otherwise.
Keyword arguments forwarded to AnchoredOffsetbox
.
If prop is passed as a keyword argument, but fontproperties is not, then prop is be assumed to be the intended fontproperties. Using both prop and fontproperties is not supported.
>>> import matplotlib.pyplot as plt >>> import numpy as np >>> from mpl_toolkits.axes_grid1.anchored_artists import ( ... AnchoredSizeBar) >>> fig, ax = plt.subplots() >>> ax.imshow(np.random.random((10, 10))) >>> bar = AnchoredSizeBar(ax.transData, 3, '3 data units', 4) >>> ax.add_artist(bar) >>> fig.show()
Using all the optional parameters
>>> import matplotlib.font_manager as fm >>> fontprops = fm.FontProperties(size=14, family='monospace') >>> bar = AnchoredSizeBar(ax.transData, 3, '3 units', 4, pad=0.5, ... sep=5, borderpad=0.5, frameon=False, ... size_vertical=0.5, color='white', ... fontproperties=fontprops)
matplotlib.offsetbox.AuxTransformBox
Container for the size bar.
matplotlib.offsetbox.TextArea
Container for the label of the size bar.
Set multiple properties at once.
Supported properties are
Property | Description |
---|---|
a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array | |
scalar or None | |
bool | |
unknown | |
unknown | |
bool | |
Patch or (Path, Transform) or None | |
str | |
float | |
bool | |
object | |
(float, float) or callable | |
None or bool or float or callable | |
bool | |
(scale: float, length: float, randomness: float) | |
bool or None | |
str | |
bool | |
float | |
float |
mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar
© 2012–2021 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.5.1/api/_as_gen/mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar.html