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

Skip to content

Commit c09cf41

Browse files
committed
Merge pull request #7 from magnunor/pelson_anchored_sizebar_fontprop
Modify AnchoredSizeBar: change fontprops argument to fontproperties
2 parents a693d00 + a1e2989 commit c09cf41

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/mpl_toolkits/axes_grid1/anchored_artists.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class AnchoredSizeBar(AnchoredOffsetbox):
7171
def __init__(self, transform, size, label, loc,
7272
pad=0.1, borderpad=0.1, sep=2, prop=None,
7373
frameon=True, size_vertical=0, color='black',
74-
label_top=False, fontprops=None,
74+
label_top=False, fontproperties=None,
7575
**kwargs):
7676
"""
7777
Draw a horizontal bar with the size in data coordinate of the given axes.
@@ -98,7 +98,7 @@ def __init__(self, transform, size, label, loc,
9898
color for the size bar and label
9999
label_top : bool, optional
100100
if True, the label will be over the rectangle
101-
fontprops: a matplotlib.font_manager.FontProperties instance, optional
101+
fontproperties: a matplotlib.font_manager.FontProperties instance, optional
102102
sets the font properties for the label text
103103
104104
Returns:
@@ -120,17 +120,17 @@ def __init__(self, transform, size, label, loc,
120120
121121
>>> import matplotlib.font_manager as fm
122122
>>> fontprops = fm.FontProperties(size=14, family='monospace')
123-
>>> bar = AnchoredSizeBar(ax.transData, 3, '3 units', 4, pad=0.5, sep=5, borderpad=0.5, frameon=False, size_vertical=0.5, color='white', fontprops=fontprops)
123+
>>> 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)
124124
125125
"""
126126

127127
self.size_bar = AuxTransformBox(transform)
128128
self.size_bar.add_artist(Rectangle((0,0), size, size_vertical, fill=True, facecolor=color, edgecolor=color))
129129

130-
if not fontprops:
130+
if not fontproperties:
131131
textprops = {'color': color}
132132
else:
133-
textprops = {'color': color, 'fontproperties': fontprops}
133+
textprops = {'color': color, 'fontproperties': fontproperties}
134134

135135
self.txt_label = TextArea(
136136
label,

0 commit comments

Comments
 (0)