Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitad616c6

Browse files
authored
Merge pull request#9564 from jakevdp/fix-9557
TST: add test of normed histogram with unequal bins
2 parents95580d3 +7b3374a commitad616c6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎lib/matplotlib/tests/test_axes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,6 +1565,17 @@ def test_hist_step_log_bottom():
15651565
ax.set_ylim(9e-3,1e3)
15661566

15671567

1568+
deftest_hist_unequal_bins_density():
1569+
# Test correct behavior of normalized histogram with unequal bins
1570+
# https://github.com/matplotlib/matplotlib/issues/9557
1571+
rng=np.random.RandomState(57483)
1572+
t=rng.randn(100)
1573+
bins= [-3,-1,-0.5,0,1,5]
1574+
mpl_heights,_,_=plt.hist(t,bins=bins,density=True)
1575+
np_heights,_=np.histogram(t,bins=bins,density=True)
1576+
assert_allclose(mpl_heights,np_heights)
1577+
1578+
15681579
defcontour_dat():
15691580
x=np.linspace(-3,5,150)
15701581
y=np.linspace(-3,5,120)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp