@@ -66,10 +66,9 @@ def __init__(self, transform, width, height, angle, loc,
6666 frameon = frameon , ** kwargs )
6767
6868
69-
7069class AnchoredSizeBar (AnchoredOffsetbox ):
7170 def __init__ (self , transform , size , label , loc ,
72- pad = 0.1 , borderpad = 0.1 , sep = 2 , prop = None ,
71+ pad = 0.1 , borderpad = 0.1 , sep = 2 ,
7372 frameon = True , size_vertical = 0 , color = 'black' ,
7473 label_top = False , fontproperties = None ,
7574 ** kwargs ):
@@ -117,24 +116,32 @@ def __init__(self, transform, size, label, loc,
117116 >>> fig.show()
118117
119118 Using all the optional parameters
120-
119+
121120 >>> import matplotlib.font_manager as fm
122121 >>> 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', fontproperties=fontprops)
122+ >>> 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) # noqa
124123
125124 """
126125
127126 self .size_bar = AuxTransformBox (transform )
128- self .size_bar .add_artist (Rectangle ((0 ,0 ), size , size_vertical , fill = True , facecolor = color , edgecolor = color ))
127+ self .size_bar .add_artist (Rectangle ((0 , 0 ), size , size_vertical ,
128+ fill = True , facecolor = color ,
129+ edgecolor = color ))
129130
130- if not fontproperties :
131+ # if fontproperties is None, but `prop` is not, assume that
132+ # prop should be used to set the font properties. This is
133+ # questionable behavior
134+ if fontproperties is None and 'prop' in kwargs :
135+ fontproperties = kwargs .pop ('prop' )
136+
137+ if fontproperties is None :
131138 textprops = {'color' : color }
132139 else :
133- textprops = {'color' : color , 'fontproperties' : fontproperties }
140+ textprops = {'color' : color , 'fontproperties' : fontproperties }
134141
135142 self .txt_label = TextArea (
136- label ,
137- minimumdescent = False ,
143+ label ,
144+ minimumdescent = False ,
138145 textprops = textprops )
139146
140147 if label_top :
@@ -148,7 +155,7 @@ def __init__(self, transform, size, label, loc,
148155
149156 AnchoredOffsetbox .__init__ (self , loc , pad = pad , borderpad = borderpad ,
150157 child = self ._box ,
151- prop = prop ,
158+ prop = fontproperties ,
152159 frameon = frameon , ** kwargs )
153160
154161
0 commit comments