Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3f2567e

Browse files
author
Nathan Goldbaum
committed
Allow users to control the fill for AnchoredSizeBar
1 parent 1bf8282 commit 3f2567e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/mpl_toolkits/axes_grid1/anchored_artists.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class AnchoredSizeBar(AnchoredOffsetbox):
232232
def __init__(self, transform, size, label, loc,
233233
pad=0.1, borderpad=0.1, sep=2,
234234
frameon=True, size_vertical=0, color='black',
235-
label_top=False, fontproperties=None,
235+
label_top=False, fontproperties=None, fill_bar=False,
236236
**kwargs):
237237
"""
238238
Draw a horizontal scale bar with a center-aligned label underneath.
@@ -295,6 +295,11 @@ def __init__(self, transform, size, label, loc,
295295
fontproperties : `matplotlib.font_manager.FontProperties`, optional
296296
Font properties for the label text.
297297
298+
fill_bar : bool, optional
299+
If True and if size_vertical is nonzero, the size bar will
300+
be filled in with the color specified by the size bar.
301+
Defaults to False.
302+
298303
**kwargs :
299304
Keyworded arguments to pass to
300305
:class:`matplotlib.offsetbox.AnchoredOffsetbox`.
@@ -336,7 +341,7 @@ def __init__(self, transform, size, label, loc,
336341
"""
337342
self.size_bar = AuxTransformBox(transform)
338343
self.size_bar.add_artist(Rectangle((0, 0), size, size_vertical,
339-
fill=False, facecolor=color,
344+
fill=fill_bar, facecolor=color,
340345
edgecolor=color))
341346

342347
if fontproperties is None and 'prop' in kwargs:

0 commit comments

Comments
 (0)