Skip to content

Commit c499668

Browse files
committed
silence warnings, matplotlib deprecated normed in favor of density
1 parent a75e76d commit c499668

3 files changed

Lines changed: 29 additions & 29 deletions

File tree

doc/source/docs/howto_document.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ The sections of the docstring are:
384384
and neural-network techniques," Computers & Geosciences, vol. 22,
385385
pp. 585-588, 1996.
386386

387-
which renders as
387+
which renders as [1]_
388388

389389
.. [1] O. McNoleg, "The integration of GIS, remote sensing,
390390
expert systems and adaptive co-kriging for environmental habitat

doc/source/f2py/python-usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ Sometimes a Fortran package may require that users provide routines
215215
that the package will use. F2PY can construct an interface to such
216216
routines so that Python functions could be called from Fortran.
217217

218-
Consider the following `Fortran 77 subroutine`__ that takes an array
218+
Consider the following Fortran 77 subroutine that takes an array
219219
and applies a function ``func`` to its elements.
220220

221221
.. include:: calculate.f

numpy/random/mtrand/mtrand.pyx

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ cdef class RandomState:
12841284
probability density function:
12851285
12861286
>>> import matplotlib.pyplot as plt
1287-
>>> count, bins, ignored = plt.hist(s, 15, normed=True)
1287+
>>> count, bins, ignored = plt.hist(s, 15, density=True)
12881288
>>> plt.plot(bins, np.ones_like(bins), linewidth=2, color='r')
12891289
>>> plt.show()
12901290
@@ -1495,7 +1495,7 @@ cdef class RandomState:
14951495
Display results as a histogram:
14961496
14971497
>>> import matplotlib.pyplot as plt
1498-
>>> count, bins, ignored = plt.hist(dsums, 11, normed=True)
1498+
>>> count, bins, ignored = plt.hist(dsums, 11, density=True)
14991499
>>> plt.show()
15001500
15011501
"""
@@ -1631,7 +1631,7 @@ cdef class RandomState:
16311631
the probability density function:
16321632
16331633
>>> import matplotlib.pyplot as plt
1634-
>>> count, bins, ignored = plt.hist(s, 30, normed=True)
1634+
>>> count, bins, ignored = plt.hist(s, 30, density=True)
16351635
>>> plt.plot(bins, 1/(sigma * np.sqrt(2 * np.pi)) *
16361636
... np.exp( - (bins - mu)**2 / (2 * sigma**2) ),
16371637
... linewidth=2, color='r')
@@ -1874,7 +1874,7 @@ cdef class RandomState:
18741874
18751875
>>> import matplotlib.pyplot as plt
18761876
>>> import scipy.special as sps
1877-
>>> count, bins, ignored = plt.hist(s, 50, normed=True)
1877+
>>> count, bins, ignored = plt.hist(s, 50, density=True)
18781878
>>> y = bins**(shape-1) * ((np.exp(-bins/scale))/ \\
18791879
... (sps.gamma(shape) * scale**shape))
18801880
>>> plt.plot(bins, y, linewidth=2, color='r')
@@ -1964,7 +1964,7 @@ cdef class RandomState:
19641964
19651965
>>> import matplotlib.pyplot as plt
19661966
>>> import scipy.special as sps
1967-
>>> count, bins, ignored = plt.hist(s, 50, normed=True)
1967+
>>> count, bins, ignored = plt.hist(s, 50, density=True)
19681968
>>> y = bins**(shape-1)*(np.exp(-bins/scale) /
19691969
... (sps.gamma(shape)*scale**shape))
19701970
>>> plt.plot(bins, y, linewidth=2, color='r')
@@ -2164,9 +2164,9 @@ cdef class RandomState:
21642164
>>> dfden = 20 # within groups degrees of freedom
21652165
>>> nonc = 3.0
21662166
>>> nc_vals = np.random.noncentral_f(dfnum, dfden, nonc, 1000000)
2167-
>>> NF = np.histogram(nc_vals, bins=50, normed=True)
2167+
>>> NF = np.histogram(nc_vals, bins=50, density=True)
21682168
>>> c_vals = np.random.f(dfnum, dfden, 1000000)
2169-
>>> F = np.histogram(c_vals, bins=50, normed=True)
2169+
>>> F = np.histogram(c_vals, bins=50, density=True)
21702170
>>> plt.plot(F[1][1:], F[0])
21712171
>>> plt.plot(NF[1][1:], NF[0])
21722172
>>> plt.show()
@@ -2342,17 +2342,17 @@ cdef class RandomState:
23422342
23432343
>>> import matplotlib.pyplot as plt
23442344
>>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),
2345-
... bins=200, normed=True)
2345+
... bins=200, density=True)
23462346
>>> plt.show()
23472347
23482348
Draw values from a noncentral chisquare with very small noncentrality,
23492349
and compare to a chisquare.
23502350
23512351
>>> plt.figure()
23522352
>>> values = plt.hist(np.random.noncentral_chisquare(3, .0000001, 100000),
2353-
... bins=np.arange(0., 25, .1), normed=True)
2353+
... bins=np.arange(0., 25, .1), density=True)
23542354
>>> values2 = plt.hist(np.random.chisquare(3, 100000),
2355-
... bins=np.arange(0., 25, .1), normed=True)
2355+
... bins=np.arange(0., 25, .1), density=True)
23562356
>>> plt.plot(values[1][0:-1], values[0]-values2[0], 'ob')
23572357
>>> plt.show()
23582358
@@ -2361,7 +2361,7 @@ cdef class RandomState:
23612361
23622362
>>> plt.figure()
23632363
>>> values = plt.hist(np.random.noncentral_chisquare(3, 20, 100000),
2364-
... bins=200, normed=True)
2364+
... bins=200, density=True)
23652365
>>> plt.show()
23662366
23672367
"""
@@ -2529,7 +2529,7 @@ cdef class RandomState:
25292529
25302530
>>> t = (np.mean(intake)-7725)/(intake.std(ddof=1)/np.sqrt(len(intake)))
25312531
>>> import matplotlib.pyplot as plt
2532-
>>> h = plt.hist(s, bins=100, normed=True)
2532+
>>> h = plt.hist(s, bins=100, density=True)
25332533
25342534
For a one-sided t-test, how far out in the distribution does the t
25352535
statistic appear?
@@ -2630,7 +2630,7 @@ cdef class RandomState:
26302630
26312631
>>> import matplotlib.pyplot as plt
26322632
>>> from scipy.special import i0
2633-
>>> plt.hist(s, 50, normed=True)
2633+
>>> plt.hist(s, 50, density=True)
26342634
>>> x = np.linspace(-np.pi, np.pi, num=51)
26352635
>>> y = np.exp(kappa*np.cos(x-mu))/(2*np.pi*i0(kappa))
26362636
>>> plt.plot(x, y, linewidth=2, color='r')
@@ -2744,7 +2744,7 @@ cdef class RandomState:
27442744
density function:
27452745
27462746
>>> import matplotlib.pyplot as plt
2747-
>>> count, bins, _ = plt.hist(s, 100, normed=True)
2747+
>>> count, bins, _ = plt.hist(s, 100, density=True)
27482748
>>> fit = a*m**a / bins**(a+1)
27492749
>>> plt.plot(bins, max(count)*fit/max(fit), linewidth=2, color='r')
27502750
>>> plt.show()
@@ -2957,17 +2957,17 @@ cdef class RandomState:
29572957
>>> powpdf = stats.powerlaw.pdf(xx,5)
29582958
29592959
>>> plt.figure()
2960-
>>> plt.hist(rvs, bins=50, normed=True)
2960+
>>> plt.hist(rvs, bins=50, density=True)
29612961
>>> plt.plot(xx,powpdf,'r-')
29622962
>>> plt.title('np.random.power(5)')
29632963
29642964
>>> plt.figure()
2965-
>>> plt.hist(1./(1.+rvsp), bins=50, normed=True)
2965+
>>> plt.hist(1./(1.+rvsp), bins=50, density=True)
29662966
>>> plt.plot(xx,powpdf,'r-')
29672967
>>> plt.title('inverse of 1 + np.random.pareto(5)')
29682968
29692969
>>> plt.figure()
2970-
>>> plt.hist(1./(1.+rvsp), bins=50, normed=True)
2970+
>>> plt.hist(1./(1.+rvsp), bins=50, density=True)
29712971
>>> plt.plot(xx,powpdf,'r-')
29722972
>>> plt.title('inverse of stats.pareto(5)')
29732973
@@ -3055,7 +3055,7 @@ cdef class RandomState:
30553055
the probability density function:
30563056
30573057
>>> import matplotlib.pyplot as plt
3058-
>>> count, bins, ignored = plt.hist(s, 30, normed=True)
3058+
>>> count, bins, ignored = plt.hist(s, 30, density=True)
30593059
>>> x = np.arange(-8., 8., .01)
30603060
>>> pdf = np.exp(-abs(x-loc)/scale)/(2.*scale)
30613061
>>> plt.plot(x, pdf)
@@ -3171,7 +3171,7 @@ cdef class RandomState:
31713171
the probability density function:
31723172
31733173
>>> import matplotlib.pyplot as plt
3174-
>>> count, bins, ignored = plt.hist(s, 30, normed=True)
3174+
>>> count, bins, ignored = plt.hist(s, 30, density=True)
31753175
>>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)
31763176
... * np.exp( -np.exp( -(bins - mu) /beta) ),
31773177
... linewidth=2, color='r')
@@ -3186,7 +3186,7 @@ cdef class RandomState:
31863186
... a = np.random.normal(mu, beta, 1000)
31873187
... means.append(a.mean())
31883188
... maxima.append(a.max())
3189-
>>> count, bins, ignored = plt.hist(maxima, 30, normed=True)
3189+
>>> count, bins, ignored = plt.hist(maxima, 30, density=True)
31903190
>>> beta = np.std(maxima) * np.sqrt(6) / np.pi
31913191
>>> mu = np.mean(maxima) - 0.57721*beta
31923192
>>> plt.plot(bins, (1/beta)*np.exp(-(bins - mu)/beta)
@@ -3381,7 +3381,7 @@ cdef class RandomState:
33813381
the probability density function:
33823382
33833383
>>> import matplotlib.pyplot as plt
3384-
>>> count, bins, ignored = plt.hist(s, 100, normed=True, align='mid')
3384+
>>> count, bins, ignored = plt.hist(s, 100, density=True, align='mid')
33853385
33863386
>>> x = np.linspace(min(bins), max(bins), 10000)
33873387
>>> pdf = (np.exp(-(np.log(x) - mu)**2 / (2 * sigma**2))
@@ -3403,7 +3403,7 @@ cdef class RandomState:
34033403
... b.append(np.product(a))
34043404
34053405
>>> b = np.array(b) / np.min(b) # scale values to be positive
3406-
>>> count, bins, ignored = plt.hist(b, 100, normed=True, align='mid')
3406+
>>> count, bins, ignored = plt.hist(b, 100, density=True, align='mid')
34073407
>>> sigma = np.std(np.log(b))
34083408
>>> mu = np.mean(np.log(b))
34093409
@@ -3480,7 +3480,7 @@ cdef class RandomState:
34803480
--------
34813481
Draw values from the distribution and plot the histogram
34823482
3483-
>>> values = hist(np.random.rayleigh(3, 100000), bins=200, normed=True)
3483+
>>> values = hist(np.random.rayleigh(3, 100000), bins=200, density=True)
34843484
34853485
Wave heights tend to follow a Rayleigh distribution. If the mean wave
34863486
height is 1 meter, what fraction of waves are likely to be larger than 3
@@ -3572,7 +3572,7 @@ cdef class RandomState:
35723572
Draw values from the distribution and plot the histogram:
35733573
35743574
>>> import matplotlib.pyplot as plt
3575-
>>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, normed=True)
3575+
>>> h = plt.hist(np.random.wald(3, 2, 100000), bins=200, density=True)
35763576
>>> plt.show()
35773577
35783578
"""
@@ -3659,7 +3659,7 @@ cdef class RandomState:
36593659
36603660
>>> import matplotlib.pyplot as plt
36613661
>>> h = plt.hist(np.random.triangular(-3, 0, 8, 100000), bins=200,
3662-
... normed=True)
3662+
... density=True)
36633663
>>> plt.show()
36643664
36653665
"""
@@ -3969,7 +3969,7 @@ cdef class RandomState:
39693969
Display histogram of the sample:
39703970
39713971
>>> import matplotlib.pyplot as plt
3972-
>>> count, bins, ignored = plt.hist(s, 14, normed=True)
3972+
>>> count, bins, ignored = plt.hist(s, 14, density=True)
39733973
>>> plt.show()
39743974
39753975
Draw each 100 values for lambda 100 and 500:
@@ -4066,7 +4066,7 @@ cdef class RandomState:
40664066
40674067
Truncate s values at 50 so plot is interesting:
40684068
4069-
>>> count, bins, ignored = plt.hist(s[s<50], 50, normed=True)
4069+
>>> count, bins, ignored = plt.hist(s[s<50], 50, density=True)
40704070
>>> x = np.arange(1., 50.)
40714071
>>> y = x**(-a) / special.zetac(a)
40724072
>>> plt.plot(x, y/max(y), linewidth=2, color='r')

0 commit comments

Comments
 (0)