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 a06f25e

Browse filesBrowse files
committed
FIX: update not replace hist_kwargs when density is passed
closes #13982
1 parent a3e2897 commit a06f25e
Copy full SHA for a06f25e

File tree

Expand file treeCollapse file tree

2 files changed

+8
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-1
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6686,7 +6686,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
66866686

66876687
density = bool(density) or bool(normed)
66886688
if density and not stacked:
6689-
hist_kwargs = dict(density=density)
6689+
hist_kwargs['density'] = density
66906690

66916691
# List to store all the top coordinates of the histograms
66926692
tops = []

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6369,3 +6369,10 @@ def test_hist_nan_data():
63696369

63706370
assert np.allclose(bins, nanbins)
63716371
assert np.allclose(edges, nanedges)
6372+
6373+
6374+
def test_hist_range_and_density():
6375+
_, bins, _ = plt.hist(np.random.rand(10), "auto",
6376+
range=(0, 1), density=True)
6377+
assert bins[0] == 0
6378+
assert bins[-1] == 1

0 commit comments

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