Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 57d658c

Browse files
committed
updates to doc
svn path=/trunk/matplotlib/; revision=6550
1 parent 2b6c934 commit 57d658c

11 files changed

Lines changed: 136 additions & 16 deletions

File tree

doc/api/artist_api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ matplotlib artists
1515
:undoc-members:
1616
:show-inheritance:
1717

18+
:mod:`matplotlib.legend`
19+
=============================
20+
21+
.. automodule:: matplotlib.legend
22+
:members:
23+
:undoc-members:
24+
:show-inheritance:
25+
1826
:mod:`matplotlib.lines`
1927
=============================
2028

doc/devel/coding_guide.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ Branch checkouts, eg the maintenance branch::
2727
svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\
2828
v0_91_maint mpl91 --username=youruser --password=yourpass
2929

30+
The current release of the trunk is in the 0.98.4 maintenance branch::
31+
32+
svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/\
33+
v0_98_4_maint mpl98.4 --username=youruser --password=yourpass
34+
35+
3036
Committing changes
3137
------------------
3238

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import matplotlib.patches as mpatch
2+
import matplotlib.pyplot as plt
3+
4+
figheight = 8
5+
fig = plt.figure(1, figsize=(9, figheight), dpi=80)
6+
fontsize = 0.4 * fig.dpi
7+
8+
def make_boxstyles(ax):
9+
styles = mpatch.BoxStyle.get_styles()
10+
11+
for i, (stylename, styleclass) in enumerate(styles.items()):
12+
ax.text(0.5, (float(len(styles)) - 0.5 - i)/len(styles), stylename,
13+
ha="center",
14+
size=fontsize,
15+
transform=ax.transAxes,
16+
bbox=dict(boxstyle=stylename, fc="w", ec="k"))
17+
18+
def make_arrowstyles(ax):
19+
styles = mpatch.ArrowStyle.get_styles()
20+
21+
ax.set_xlim(0, 4)
22+
ax.set_ylim(0, figheight)
23+
24+
for i, (stylename, styleclass) in enumerate(sorted(styles.items())):
25+
y = (float(len(styles)) -0.25 - i) # /figheight
26+
p = mpatch.Circle((3.2, y), 0.2, fc="w")
27+
ax.add_patch(p)
28+
29+
ax.annotate(stylename, (3.2, y),
30+
(2., y),
31+
#xycoords="figure fraction", textcoords="figure fraction",
32+
ha="right", va="center",
33+
size=fontsize,
34+
arrowprops=dict(arrowstyle=stylename,
35+
patchB=p,
36+
shrinkA=5,
37+
shrinkB=5,
38+
fc="w", ec="k",
39+
connectionstyle="arc3,rad=-0.05",
40+
),
41+
bbox=dict(boxstyle="square", fc="w"))
42+
43+
ax.xaxis.set_visible(False)
44+
ax.yaxis.set_visible(False)
45+
46+
47+
ax1 = fig.add_subplot(121, frameon=False, xticks=[], yticks=[])
48+
make_boxstyles(ax1)
49+
50+
ax2 = fig.add_subplot(122, frameon=False, xticks=[], yticks=[])
51+
make_arrowstyles(ax2)
52+
53+
54+
plt.show()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env python
2+
import matplotlib.mlab as mlab
3+
from pylab import figure, show
4+
import numpy as np
5+
6+
x = np.arange(0.0, 2, 0.01)
7+
y1 = np.sin(2*np.pi*x)
8+
y2 = 1.2*np.sin(4*np.pi*x)
9+
10+
fig = figure()
11+
ax = fig.add_subplot(111)
12+
ax.plot(x, y1, x, y2, color='black')
13+
ax.fill_between(x, y1, y2, where=y2>y1, facecolor='green')
14+
ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
15+
ax.set_title('fill between where')
16+
17+
show()
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
import matplotlib.pyplot as plt
4+
5+
6+
ax = plt.subplot(111)
7+
t1 = np.arange(0.0, 1.0, 0.1)
8+
for n in [1, 2, 3, 4]:
9+
plt.plot(t1, t1**n, label="n=%d"%(n,))
10+
11+
leg = plt.legend(loc='best', ncol=4, mode="expand", shadow=True, fancybox=True)
12+
leg.get_frame().set_alpha(0.7)
13+
14+
15+
plt.show()
16+
17+
18+

doc/users/whats_new.rst

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ Legend enhancements
1919

2020
Jae-Joon has rewritten the legend class, and added support for
2121
multiple columns and rows, as well as fancy box drawing. See
22-
:ref:`pylab_examples-legend_demo3`.
22+
:func:`~matplotlib.pyplot.legend` and
23+
:class:`matplotlib.legend.Legend`.
2324

25+
.. plot:: pyplots/whats_new_98_4_legend.py
2426

2527
.. _fancy-annotations:
2628

@@ -29,8 +31,12 @@ Fancy annotations and arrows
2931

3032
Jae-Joon has added lot's of support to annotations for drawing fancy
3133
boxes and connectors in annotations. See
32-
:ref:`pylab_examples-annotation_demo2` and
33-
:ref:`pylab_examples-fancyarrow_demo`.
34+
:func:`~matplotlib.pyplot.annotate` and
35+
:class:`~matplotlib.patches.BoxStyle`,
36+
:class:`~matplotlib.patches.ArrowStyle`, and
37+
:class:`~matplotlib.patches.ConnectionStyle`.
38+
39+
.. plot:: pyplots/whats_new_98_4_fancy.py
3440

3541
.. _psd-amplitude:
3642

@@ -49,8 +55,12 @@ Fill between
4955
------------------
5056

5157
Added a :func:`~matplotlib.pyplot.fill_between` function to make it
52-
easier to do shaded region plots in the presence of masked data. See
53-
:ref:`pylab_examples-fill_between`.
58+
easier to do shaded region plots in the presence of masked data. You
59+
can pass an *x* array and a *ylower* and *yupper* array to fill
60+
betweem, and an optional *where* argument which is a logical mask
61+
where you want to do the filling.
62+
63+
.. plot:: pyplots/whats_new_98_4_fill_between.py
5464

5565
Lots more
5666
-----------

examples/pylab_examples/psd_demo2.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#Plot the raw time series
1212
fig = plt.figure()
13+
fig.subplots_adjust(hspace=0.45, wspace=0.3)
1314
ax = fig.add_subplot(2, 1, 1)
1415
ax.plot(t, y)
1516

@@ -19,21 +20,23 @@
1920
ax2.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs)
2021
ax2.psd(y, NFFT=len(t), pad_to=len(t)*2, Fs=fs)
2122
ax2.psd(y, NFFT=len(t), pad_to=len(t)*4, Fs=fs)
22-
plt.title('Effect of zero padding')
23+
plt.title('zero padding')
2324

2425
#Plot the PSD with different block sizes, Zero pad to the length of the orignal
2526
#data sequence.
2627
ax3 = fig.add_subplot(2, 3, 5, sharex=ax2, sharey=ax2)
2728
ax3.psd(y, NFFT=len(t), pad_to=len(t), Fs=fs)
2829
ax3.psd(y, NFFT=len(t)//2, pad_to=len(t), Fs=fs)
2930
ax3.psd(y, NFFT=len(t)//4, pad_to=len(t), Fs=fs)
30-
plt.title('Effect of block size')
31+
ax3.set_ylabel('')
32+
plt.title('block size')
3133

3234
#Plot the PSD with different amounts of overlap between blocks
3335
ax4 = fig.add_subplot(2, 3, 6, sharex=ax2, sharey=ax2)
3436
ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=0, Fs=fs)
3537
ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.05*len(t)/2.), Fs=fs)
3638
ax4.psd(y, NFFT=len(t)//2, pad_to=len(t), noverlap=int(0.2*len(t)/2.), Fs=fs)
37-
plt.title('Effect of overlap')
39+
ax4.set_ylabel('')
40+
plt.title('overlap')
3841

3942
plt.show()

examples/pylab_examples/psd_demo3.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,23 @@
1414

1515
yticks = np.arange(-50, 30, 10)
1616
xticks = np.arange(0,550,100)
17-
17+
plt.subplots_adjust(hspace=0.45, wspace=0.3)
1818
plt.subplot(1,2,1)
19+
1920
plt.psd(xn, NFFT=301, Fs=fs, window=mlab.window_none, pad_to=1024,
2021
scale_by_freq=True)
21-
plt.title('Periodogram PSD Estimate')
22+
plt.title('Periodogram')
2223
plt.yticks(yticks)
2324
plt.xticks(xticks)
2425
plt.grid(True)
2526

2627
plt.subplot(1,2,2)
2728
plt.psd(xn, NFFT=150, Fs=fs, window=mlab.window_none, noverlap=75, pad_to=512,
2829
scale_by_freq=True)
29-
plt.title('Welch Method PSD Estimate')
30+
plt.title('Welch')
3031
plt.xticks(xticks)
3132
plt.yticks(yticks)
33+
plt.ylabel('')
3234
plt.grid(True)
3335

3436
plt.show()

lib/matplotlib/axes.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,6 +2742,8 @@ def annotate(self, *args, **kwargs):
27422742
Keyword arguments:
27432743
27442744
%(Annotation)s
2745+
2746+
.. plot:: mpl_examples/pylab_examples/annotation_demo2.py
27452747
"""
27462748
a = mtext.Annotation(*args, **kwargs)
27472749
a.set_transform(mtransforms.IdentityTransform())
@@ -5587,14 +5589,11 @@ def fill_between(self, x, y1, y2=0, where=None, **kwargs):
55875589
*kwargs*
55885590
keyword args passed on to the :class:`PolyCollection`
55895591
5590-
.. seealso::
5591-
:file:`examples/pylab_examples/fill_between.py`:
5592-
For more examples.
5593-
55945592
kwargs control the Polygon properties:
55955593
55965594
%(PolyCollection)s
55975595
5596+
.. plot:: mpl_examples/pylab_examples/fill_between.py
55985597
"""
55995598
# Handle united data, such as dates
56005599
self._process_unit_info(xdata=x, ydata=y1, kwargs=kwargs)

lib/matplotlib/legend.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class Legend(Artist):
4747
sequence of strings and loc can be a string or an integer
4848
specifying the legend location
4949
50-
The location codes are
50+
The location codes are::
5151
5252
'best' : 0, (only implemented for axis legends)
5353
'upper right' : 1,

0 commit comments

Comments
 (0)