Skip to content

Commit b448745

Browse files
committed
Merge remote-tracking branch 'upstream/v1.2.x'
Conflicts: lib/matplotlib/axes.py
2 parents 4eee8fc + 2dc2825 commit b448745

File tree

5 files changed

+2113
-1
lines changed

5 files changed

+2113
-1
lines changed

lib/matplotlib/axes.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -8218,11 +8218,27 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
82188218
x += 0.5 * (bins[1] - bins[0])
82198219

82208220
if log:
8221-
y[0], y[-1] = minimum, minimum
82228221
if orientation == 'horizontal':
82238222
self.set_xscale('log')
8223+
logbase = self.xaxis._scale.base
82248224
else: # orientation == 'vertical'
82258225
self.set_yscale('log')
8226+
logbase = self.yaxis._scale.base
8227+
8228+
# Setting a minimum of 0 results in problems for log plots
8229+
if normed:
8230+
# For normed data, set to log base * minimum data value
8231+
# (gives 1 full tick-label unit for the lowest filled bin)
8232+
ndata = np.array(n)
8233+
minimum = (np.min(ndata[ndata>0])) / logbase
8234+
else:
8235+
# For non-normed data, set the min to log base, again so that
8236+
# there is 1 full tick-label unit for the lowest bin
8237+
minimum = 1.0 / logbase
8238+
8239+
y[0], y[-1] = minimum, minimum
8240+
else:
8241+
minimum = np.min(bins)
82268242

82278243
# If fill kwarg is set, it will be passed to the patch collection,
82288244
# overriding this
Binary file not shown.
Loading

0 commit comments

Comments
 (0)