class mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar(transform, size, label, loc, pad=0.1, borderpad=0.1, sep=2, frameon=True, size_vertical=0, color='black', label_top=False, fontproperties=None, fill_bar=None, **kwargs)
[source]
Bases: matplotlib.offsetbox.AnchoredOffsetbox
Draw a horizontal scale bar with a center-aligned label underneath.
Parameters: |
|
---|
If prop is passed as a keyworded 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)
Attributes: |
|
---|
mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar
© 2012–2018 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/3.1.1/api/_as_gen/mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar.html