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

Commitbdcaab5

Browse files
committed
Adjust documentation and test formatting
1 parent5995c58 commitbdcaab5

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

‎lib/matplotlib/axes/_axes.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5923,7 +5923,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
59235923
59245924
Default is ``None``
59255925
5926-
normed or density : boolean, optional
5926+
normed, density : boolean, optional
59275927
Either the 'normed' or the 'density' arg can be set to
59285928
accomplish this behavior:
59295929
@@ -5945,19 +5945,21 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
59455945
weights : (n, ) array_like or None, optional
59465946
An array of weights, of the same shape as `x`. Each value in `x`
59475947
only contributes its associated weight towards the bin count
5948-
(instead of 1). If `normed` and/or 'density' is True, the weights are normalized,
5949-
so that the integral of the density over the range remains 1.
5948+
(instead of 1). If `normed` and/or 'density' is True,
5949+
the weights are normalized, so that the integral of the density
5950+
over the range remains 1.
59505951
59515952
Default is ``None``
59525953
59535954
cumulative : boolean, optional
59545955
If `True`, then a histogram is computed where each bin gives the
59555956
counts in that bin plus all bins for smaller values. The last bin
5956-
gives the total number of datapoints. If `normed` and/or 'density' is also `True`
5957-
then the histogram is normalized such that the last bin equals 1.
5958-
If `cumulative` evaluates to less than 0 (e.g., -1), the direction
5959-
of accumulation is reversed. In this case, if `normed` and/or 'density' is also
5960-
`True`, then the histogram is normalized such that the first bin
5957+
gives the total number of datapoints. If `normed` and/or 'density'
5958+
is also `True` then the histogram is normalized such that the last
5959+
bin equals 1. If `cumulative` evaluates to less than 0 (e.g., -1),
5960+
the direction of accumulation is reversed. In this case, if
5961+
`normed` and/or 'density' is also `True`, then the histogram is
5962+
normalized such that the first bin
59615963
equals 1.
59625964
59635965
Default is ``False``
@@ -6077,12 +6079,14 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
60776079
60786080
"""
60796081

6080-
# This sets the density variable, if necessary, to its predecessor, 'normed.'
6081-
ifdensity!=Noneandnormed!=Noneanddensity!=normed:
6082-
raiseValueError('The density and normed arguments represent the same concept. Please set only one of them, or set them to the same value.')
6083-
elifnormed!=Noneanddensity==None:
6082+
# Sets the density variable, if necessary, to its predecessor, 'normed.'
6083+
ifdensityisnotNoneandnormedisnotNoneanddensityisnotnormed:
6084+
raiseValueError('The density and normed arguments represent the '
6085+
'same concept. Please set only one of them, or '
6086+
'set them to the same value.')
6087+
elifnormedisnotNoneanddensityisNone:
60846088
density=normed
6085-
elifnormed==Noneanddensity==None:
6089+
elifnormedisNoneanddensityisNone:
60866090
density=False
60876091

60886092
def_normalize_input(inp,ename='input'):

‎lib/matplotlib/tests/test_axes.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2541,13 +2541,13 @@ def test_hist_stacked_normed():
25412541
ax=fig.add_subplot(111)
25422542
ax.hist((d1,d2),stacked=True,normed=True)
25432543

2544+
25442545
@image_comparison(baseline_images=['hist_stacked_normed'])
25452546
deftest_hist_stacked_density():
25462547
# make some data
25472548
d1=np.linspace(1,3,20)
25482549
d2=np.linspace(0,10,50)
2549-
fig=plt.figure()
2550-
ax=fig.add_subplot(111)
2550+
fig,ax=plt.subplots()
25512551
ax.hist((d1,d2),stacked=True,density=True)
25522552

25532553
withpytest.raises(ValueError):
@@ -3274,6 +3274,10 @@ def test_specgram_angle_freqs():
32743274
noverlap=noverlap,pad_to=pad_to,sides='onesided',
32753275
mode='phase',scale='dB')
32763276

3277+
withpytest.raises(ValueError):
3278+
ax13.specgram(y,NFFT=NFFT,Fs=Fs,
3279+
noverlap=noverlap,pad_to=pad_to,sides='twosided',
3280+
mode='phase',scale='dB')
32773281

32783282

32793283
@image_comparison(baseline_images=['specgram_angle_noise'],

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp