Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 637a565

Browse filesBrowse files
committed
Merge pull request #2372 from neggert/hist_endline_fix
Fix step histogram endline
2 parents 0669571 + 7018c91 commit 637a565
Copy full SHA for 637a565

File tree

Expand file treeCollapse file tree

3 files changed

+14
-3
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+14
-3
lines changed

‎lib/matplotlib/axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8457,11 +8457,11 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
84578457
xvals, yvals = [], []
84588458
for m in n:
84598459
# starting point for drawing polygon
8460-
y[0] = y[-1]
8460+
y[0] = y[1]
84618461
# top of the previous polygon becomes the bottom
84628462
y[2*len(bins)-1:] = y[1:2*len(bins)-1][::-1]
84638463
# set the top of this polygon
8464-
y[1:2*len(bins)-1:2], y[2:2*len(bins):2] = m, m
8464+
y[1:2*len(bins)-1:2], y[2:2*len(bins)-1:2] = m, m
84658465
if log:
84668466
y[y < minimum] = minimum
84678467
if orientation == 'horizontal':
@@ -8481,7 +8481,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
84818481
facecolor=c))
84828482
else:
84838483
for x, y, c in reversed(zip(xvals, yvals, color)):
8484-
split = int(len(x) / 2) + 1
8484+
split = 2 * len(bins)
84858485
patches.append(self.fill(
84868486
x[:split], y[:split],
84878487
closed=False, edgecolor=c,
Loading

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,17 @@ def test_hist_offset():
10621062
ax.hist(d2, bottom=15)
10631063

10641064

1065+
@image_comparison(baseline_images=['hist_step'], extensions=['png'], remove_text=True)
1066+
def test_hist_step():
1067+
# make some data
1068+
d1 = np.linspace(1, 3, 20)
1069+
fig = plt.figure()
1070+
ax = fig.add_subplot(111)
1071+
ax.hist( d1, histtype="step")
1072+
ax.set_ylim(0, 10)
1073+
ax.set_xlim(-1, 5)
1074+
1075+
10651076
@image_comparison(baseline_images=['hist_stacked_weights'])
10661077
def test_hist_stacked_weighted():
10671078
# make some data

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.