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 fb3b30b

Browse filesBrowse files
authored
Merge pull request #9586 from matplotlib/auto-backport-of-pr-9564
Backport PR #9564 on branch v2.1.x
2 parents f8f6385 + fd76d04 commit fb3b30b
Copy full SHA for fb3b30b

File tree

Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-0
lines changed

‎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
@@ -1525,6 +1525,17 @@ def test_hist_step_log_bottom():
15251525
ax.set_ylim(9e-3, 1e3)
15261526

15271527

1528+
def test_hist_unequal_bins_density():
1529+
# Test correct behavior of normalized histogram with unequal bins
1530+
# https://github.com/matplotlib/matplotlib/issues/9557
1531+
rng = np.random.RandomState(57483)
1532+
t = rng.randn(100)
1533+
bins = [-3, -1, -0.5, 0, 1, 5]
1534+
mpl_heights, _, _ = plt.hist(t, bins=bins, density=True)
1535+
np_heights, _ = np.histogram(t, bins=bins, density=True)
1536+
assert_allclose(mpl_heights, np_heights)
1537+
1538+
15281539
def contour_dat():
15291540
x = np.linspace(-3, 5, 150)
15301541
y = np.linspace(-3, 5, 120)

0 commit comments

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