Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented fix to issue 196 on github for log=True and histtype='step' #1029

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/matplotlib/axes.py
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