@@ -2879,6 +2879,9 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
28792879 *linestyle*:
28802880 [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
28812881
2882+ **Example:**
2883+
2884+ .. plot:: ../mpl_examples/pylab_examples/hline_demo.py
28822885 """
28832886 if kwargs .get ('fmt' ) is not None :
28842887 raise DeprecationWarning (
@@ -3362,6 +3365,13 @@ def acorr(self, x, **kwargs):
33623365 See the respective :meth:`~matplotlib.axes.Axes.plot` or
33633366 :meth:`~matplotlib.axes.Axes.vlines` functions for
33643367 documentation on valid kwargs.
3368+
3369+ **Example:**
3370+
3371+ :func:`~matplotlib.pyplot.xcorr` above, and
3372+ :func:`~matplotlib.pyplot.acorr` below.
3373+
3374+ .. plot:: ../mpl_examples/pylab_examples/xcorr_demo.py
33653375 """
33663376 return self .xcorr (x , x , ** kwargs )
33673377 acorr .__doc__ = cbook .dedent (acorr .__doc__ ) % martist .kwdocd
@@ -3410,6 +3420,13 @@ def xcorr(self, x, y, normed=False, detrend=mlab.detrend_none, usevlines=False,
34103420
34113421 *maxlags* is a positive integer detailing the number of lags to show.
34123422 The default value of *None* will return all ``(2*len(x)-1)`` lags.
3423+
3424+ **Example:**
3425+
3426+ :func:`~matplotlib.pyplot.xcorr` above, and
3427+ :func:`~matplotlib.pyplot.acorr` below.
3428+
3429+ .. plot:: ../mpl_examples/pylab_examples/xcorr_demo.py
34133430 """
34143431
34153432 Nx = len (x )
@@ -3706,6 +3723,12 @@ def bar(self, left, height, width=0.8, bottom=None,
37063723 Other optional kwargs:
37073724
37083725 %(Rectangle)s
3726+
3727+ **Example:**
3728+
3729+ A stacked bar chart.
3730+
3731+ .. plot:: ../mpl_examples/pylab_examples/bar_stacked.py
37093732 """
37103733 if not self ._hold : self .cla ()
37113734
@@ -3998,6 +4021,10 @@ def broken_barh(self, xranges, yrange, **kwargs):
39984021 or a sequence of arguments for the various bars, ie::
39994022
40004023 facecolors = ('black', 'red', 'green')
4024+
4025+ **Example:**
4026+
4027+ .. plot:: ../mpl_examples/pylab_examples/broken_barh.py
40014028 """
40024029 col = mcoll .BrokenBarHCollection (xranges , yrange , ** kwargs )
40034030 self .add_collection (col , autolim = True )
@@ -5013,6 +5040,10 @@ def hexbin(self, x, y, gridsize = 100, bins = None,
50135040 :meth:`~matplotlib.collection.PolyCollection.get_array` on
50145041 this :class:`~matplotlib.collections.PolyCollection` to get
50155042 the counts in each hexagon.
5043+
5044+ **Example:**
5045+
5046+ .. plot:: ../mpl_examples/pylab_examples/hexbin_demo.py
50165047 """
50175048
50185049 if not self ._hold : self .cla ()
@@ -5166,6 +5197,10 @@ def arrow(self, x, y, dx, dy, **kwargs):
51665197
51675198 Optional kwargs control the arrow properties:
51685199 %(FancyArrow)s
5200+
5201+ **Example:**
5202+
5203+ .. plot:: ../mpl_examples/pylab_examples/arrow_demo.py
51695204 """
51705205 a = mpatches .FancyArrow (x , y , dx , dy , ** kwargs )
51715206 self .add_artist (a )
@@ -5225,6 +5260,10 @@ def fill(self, *args, **kwargs):
52255260 kwargs control the Polygon properties:
52265261
52275262 %(Polygon)s
5263+
5264+ **Example:**
5265+
5266+ .. plot:: ../mpl_examples/pylab_examples/fill_demo.py
52285267 """
52295268 if not self ._hold : self .cla ()
52305269
@@ -5334,6 +5373,10 @@ def imshow(self, X, cmap=None, norm=None, aspect=None,
53345373 Additional kwargs are :class:`~matplotlib.artist.Artist` properties:
53355374
53365375 %(Artist)s
5376+
5377+ **Example:**
5378+
5379+ .. plot:: ../mpl_examples/pylab_examples/image_demo.py
53375380 """
53385381
53395382 if not self ._hold : self .cla ()
@@ -6081,42 +6124,6 @@ def hist(self, x, bins=10, range=None, normed=False, cumulative=False,
60816124
60826125 %(Rectangle)s
60836126
6084- Here is an example which generates a histogram of normally
6085- distributed random numbers and plot the analytic PDF over it::
6086-
6087- import numpy as np
6088- import matplotlib.pyplot as plt
6089- import matplotlib.mlab as mlab
6090-
6091- mu, sigma = 100, 15
6092- x = mu + sigma * np.random.randn(10000)
6093-
6094- fig = plt.figure()
6095- ax = fig.add_subplot(111)
6096-
6097- # the histogram of the data
6098- n, bins, patches = ax.hist(x, 50, normed=1, facecolor='green', alpha=0.75)
6099-
6100- # hist uses np.histogram under the hood to create 'n' and 'bins'.
6101- # np.histogram returns the bin edges, so there will be 50 probability
6102- # density values in n, 51 bin edges in bins and 50 patches. To get
6103- # everything lined up, we'll compute the bin centers
6104- bincenters = 0.5*(bins[1:]+bins[:-1])
6105-
6106- # add a 'best fit' line for the normal PDF
6107- y = mlab.normpdf( bincenters, mu, sigma)
6108- l = ax.plot(bincenters, y, 'r--', linewidth=1)
6109-
6110- ax.set_xlabel('Smarts')
6111- ax.set_ylabel('Probability')
6112- ax.set_title(r'$\mathrm{Histogram\ of\ IQ:}\ \mu=100,\ \sigma=15$')
6113- ax.set_xlim(40, 160)
6114- ax.set_ylim(0, 0.03)
6115- ax.grid(True)
6116-
6117- #fig.savefig('histogram_demo',dpi=72)
6118- plt.show()
6119-
61206127 You can use labels for your histogram, and only the first
61216128 :class:`~matplotlib.patches.Rectangle` gets the label (the
61226129 others get the magic string '_nolegend_'. This will make the
@@ -6126,6 +6133,9 @@ def hist(self, x, bins=10, range=None, normed=False, cumulative=False,
61266133 ax.hist(12+3*np.random.randn(1000), label='women', alpha=0.5)
61276134 ax.legend()
61286135
6136+ **Example:**
6137+
6138+ .. plot:: ../mpl_examples/pylab_examples/histogram_demo.py
61296139 """
61306140 if not self ._hold : self .cla ()
61316141
@@ -6413,6 +6423,10 @@ def csd(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
64136423 kwargs control the Line2D properties:
64146424
64156425 %(Line2D)s
6426+
6427+ **Example:**
6428+
6429+ .. plot:: ../mpl_examples/pylab_examples/csd_demo.py
64166430 """
64176431 if not self ._hold : self .cla ()
64186432 pxy , freqs = mlab .csd (x , y , NFFT , Fs , detrend , window , noverlap )
@@ -6466,6 +6480,10 @@ def cohere(self, x, y, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
64666480 properties of the coherence plot:
64676481
64686482 %(Line2D)s
6483+
6484+ **Example:**
6485+
6486+ .. plot:: ../mpl_examples/pylab_examples/cohere_demo.py
64696487 """
64706488 if not self ._hold : self .cla ()
64716489 cxy , freqs = mlab .cohere (x , y , NFFT , Fs , detrend , window , noverlap )
0 commit comments