Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/matplotlib/axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7861,7 +7861,19 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,

x[0::2], x[1::2] = bins, bins

minimum = min(bins)
if log:
# setting a minimum of 0 results in problems for log plots
if normed:
# for normed data, set to 0.1 * minimum data value
# (gives 1 full dex for the lowest filled bin)
ndata = np.array(n)
minimum = (ndata[ndata>0].min())*0.1
else:
# for non-normed data, set the min to 0.1, again so that
# there is 1 full dex for the lowest bin
minimum = 0.1
else:
minimum = min(bins)

if align == 'left' or align == 'center':
x -= 0.5*(bins[1]-bins[0])
Expand Down