Skip to content

Fix #6448: set xmin/ymin even without non-zero bins in 'step' hist #7323

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

Merged
merged 1 commit into from
Oct 22, 2016
Merged
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
18 changes: 13 additions & 5 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6390,7 +6390,7 @@ def _normalize_input(inp, ename='input'):
xvals.append(x.copy())
yvals.append(y.copy())

#stepfill is closed, step is not
# stepfill is closed, step is not
split = -1 if fill else 2 * len(bins)
# add patches in reverse order so that when stacking,
# items lower in the stack are plottted on top of
Expand All @@ -6412,9 +6412,13 @@ def _normalize_input(inp, ename='input'):
xmin0 = max(_saved_bounds[0]*0.9, minimum)
xmax = self.dataLim.intervalx[1]
for m in n:
if np.sum(m) > 0: # make sure there are counts
xmin = np.amin(m[m != 0])
# make sure there are counts
if np.sum(m) > 0:
# filter out the 0 height bins
xmin = np.amin(m[m != 0])
# If no counts, set min to zero
else:
xmin = 0.0
xmin = max(xmin*0.9, minimum) if not input_empty else minimum
xmin = min(xmin0, xmin)
self.dataLim.intervalx = (xmin, xmax)
Expand All @@ -6423,9 +6427,13 @@ def _normalize_input(inp, ename='input'):
ymax = self.dataLim.intervaly[1]

for m in n:
if np.sum(m) > 0: # make sure there are counts
ymin = np.amin(m[m != 0])
# make sure there are counts
if np.sum(m) > 0:
# filter out the 0 height bins
ymin = np.amin(m[m != 0])
# If no counts, set min to zero
else:
ymin = 0.0
ymin = max(ymin*0.9, minimum) if not input_empty else minimum
ymin = min(ymin0, ymin)
self.dataLim.intervaly = (ymin, ymax)
Expand Down