@@ -8185,16 +8185,25 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8185
8185
x [0 ::2 ], x [1 ::2 ] = bins , bins
8186
8186
8187
8187
if log :
8188
+ if orientation == 'horizontal' :
8189
+ self .set_xscale ('log' )
8190
+ logbase = self .xaxis ._scale .base
8191
+ else : # orientation == 'vertical'
8192
+ self .set_yscale ('log' )
8193
+ logbase = self .yaxis ._scale .base
8194
+
8188
8195
# setting a minimum of 0 results in problems for log plots
8189
8196
if normed :
8190
8197
# for normed data, set to 0.1 * minimum data value
8191
8198
# (gives 1 full dex for the lowest filled bin)
8192
8199
ndata = np .array (n )
8193
- minimum = (np .min (ndata [ndata > 0 ]))* 0.1
8200
+ minimum = (np .min (ndata [ndata > 0 ])) / logbase
8194
8201
else :
8195
8202
# for non-normed data, set the min to 0.1, again so that
8196
8203
# there is 1 full dex for the lowest bin
8197
- minimum = 0.1
8204
+ minimum = 1.0 / logbase
8205
+
8206
+ y [0 ], y [- 1 ] = minimum , minimum
8198
8207
else :
8199
8208
minimum = np .min (bins )
8200
8209
@@ -8203,13 +8212,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
8203
8212
elif align == 'right' :
8204
8213
x += 0.5 * (bins [1 ]- bins [0 ])
8205
8214
8206
- if log :
8207
- y [0 ],y [- 1 ] = minimum , minimum
8208
- if orientation == 'horizontal' :
8209
- self .set_xscale ('log' )
8210
- else : # orientation == 'vertical'
8211
- self .set_yscale ('log' )
8212
-
8213
8215
# If fill kwarg is set, it will be passed to the patch collection,
8214
8216
# overriding this
8215
8217
fill = (histtype == 'stepfilled' )
0 commit comments