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

Replace 'normed' kwarg to hist by 'density' in tests and docs.#10258

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
anntzer wants to merge1 commit intomatplotlib:masterfromanntzer:nonormed
Closed
Show file tree
Hide file tree
Changes fromall 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
2 changes: 1 addition & 1 deletionexamples/statistics/hist.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -63,7 +63,7 @@
thispatch.set_facecolor(color)

# We can also normalize our inputs by the total number of counts
axs[1].hist(x, bins=n_bins,normed=True)
axs[1].hist(x, bins=n_bins,density=True)

# Now we format the y-axis to display percentage
axs[1].yaxis.set_major_formatter(PercentFormatter(xmax=1))
Expand Down
2 changes: 1 addition & 1 deletionexamples/statistics/histogram_features.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -35,7 +35,7 @@
fig, ax = plt.subplots()

# the histogram of the data
n, bins, patches = ax.hist(x, num_bins,normed=1)
n, bins, patches = ax.hist(x, num_bins,density=True)

# add a 'best fit' line
y = mlab.normpdf(bins, mu, sigma)
Expand Down
2 changes: 1 addition & 1 deletionlib/matplotlib/tests/test_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2932,7 +2932,7 @@ def test_hist_stacked_normed():
d2 = np.linspace(0, 10, 50)
fig = plt.figure()
ax = fig.add_subplot(111)
ax.hist((d1, d2), stacked=True,normed=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think this should stay as it is, because we should still be testing thatnormed works until it is removed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

In that case, shouldn't the test have two forms, one for 'normed' and the other for 'density'? At a more general level, we never have tested everything, and never will--there are too many possible combinations. We need to concentrate on the most useful tests, putting our resources, and those of the CI services, where they will be most effective in improving mpl. Testing that a deprecated kwarg still works seems very low priority, doesn't it? The time of deprecation seems like a perfectly reasonable time to switch a test to the non-deprecated alternative.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

  • There is a test directly below this one fordensity.
  • Sure we've never tested everything, but we shouldaim to test everything. This test definitely isn't a CI bottleneck.
  • In my opinion, something being deprecated means it is still supported, but there are plans for it to be removed. If it's supported, it should be tested.

I'm not going to block on removing thenormed test, but I am -2 on it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Aiming to test everything doesn't make sense to me, for the reason stated above.

ax.hist((d1, d2), stacked=True,density=True)


@image_comparison(baseline_images=['hist_stacked_normed'], extensions=['png'])
Expand Down
3 changes: 1 addition & 2 deletionstutorials/introductory/pyplot.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -333,8 +333,7 @@ def f(t):
x = mu + sigma * np.random.randn(10000)

# the histogram of the data
n, bins, patches = plt.hist(x, 50, normed=1, facecolor='g', alpha=0.75)

n, bins, patches = plt.hist(x, 50, density=True, facecolor='g', alpha=0.75)

plt.xlabel('Smarts')
plt.ylabel('Probability')
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp