Skip to content

Commit b80e228

Browse files
committed
More docs progress.
svn path=/trunk/matplotlib/; revision=6229
1 parent a8a0eeb commit b80e228

File tree

9 files changed

+413
-296
lines changed

9 files changed

+413
-296
lines changed

doc/devel/add_new_projection.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,27 @@ A full-fledged and heavily annotated example is in
108108
:file:`examples/api/custom_projection_example.py`. The polar plot
109109
functionality in :mod:`matplotlib.projections.polar` may also be of
110110
interest.
111+
112+
API documentation
113+
=================
114+
115+
matplotlib.scale
116+
----------------
117+
118+
.. automodule:: matplotlib.scale
119+
:members:
120+
:show-inheritance:
121+
122+
matplotlib.projections
123+
----------------------
124+
125+
.. automodule:: matplotlib.projections
126+
:members:
127+
:show-inheritance:
128+
129+
matplotlib.projections.polar
130+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
131+
132+
.. automodule:: matplotlib.projections.polar
133+
:members:
134+
:show-inheritance:

doc/devel/outline.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ config/rcsetup Darren needs conversion
108108
config/tconfig Darren needs conversion
109109
config/verbose Darren needs conversion
110110
numerix/__init__ needs conversion
111-
projections/__init__ needs conversion
112-
projections/geo needs conversion
113-
projections/polar needs conversion
111+
projections/__init__ Mike converted
112+
projections/geo Mike converted (not included--experimental)
113+
projections/polar Mike converted
114114
afm converted
115115
artist converted
116116
axes converted
@@ -134,18 +134,18 @@ lines needs conversion
134134
mathtext needs conversion
135135
mlab needs conversion
136136
mpl needs conversion
137-
patches needs conversion
138-
path needs conversion
139-
pylab needs conversion
137+
patches Mike converted
138+
path Mike converted
139+
pylab no docstrings
140140
pyplot converted
141141
quiver needs conversion
142142
rcsetup needs conversion
143-
scale needs conversion
143+
scale Mike converted
144144
table needs conversion
145145
texmanager Darren needs conversion
146146
text Mike converted
147147
ticker Mike needs conversion
148-
transforms needs conversion
148+
transforms Mike converted
149149
type1font needs conversion
150150
units needs conversion
151151
widgets needs conversion

lib/matplotlib/colors.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
Commands which take color arguments can use several formats to specify
99
the colors. For the basic builtin colors, you can use a single letter
1010
11-
b : blue
12-
g : green
13-
r : red
14-
c : cyan
15-
m : magenta
16-
y : yellow
17-
k : black
18-
w : white
11+
- b : blue
12+
- g : green
13+
- r : red
14+
- c : cyan
15+
- m : magenta
16+
- y : yellow
17+
- k : black
18+
- w : white
1919
2020
Gray shades can be given as a string encoding a float in the 0-1
2121
range, e.g.::

lib/matplotlib/patches.py

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def contains(self, mouseevent):
8282
return inside, {}
8383

8484
def update_from(self, other):
85+
"""
86+
Updates this :class:`Patch` from the properties of *other*.
87+
"""
8588
artist.Artist.update_from(self, other)
8689
self.set_edgecolor(other.get_edgecolor())
8790
self.set_facecolor(other.get_facecolor())
@@ -94,9 +97,17 @@ def update_from(self, other):
9497
self.set_alpha(other.get_alpha())
9598

9699
def get_extents(self):
100+
"""
101+
Return a :class:`~matplotlib.transforms.Bbox` object defining
102+
the axis-aligned extents of the :class:`Patch`.
103+
"""
97104
return self.get_path().get_extents(self.get_transform())
98105

99106
def get_transform(self):
107+
"""
108+
Return the :class:`~matplotlib.transforms.Transform` applied
109+
to the :class:`Patch`.
110+
"""
100111
return self.get_patch_transform() + artist.Artist.get_transform(self)
101112

102113
def get_data_transform(self):
@@ -106,22 +117,38 @@ def get_patch_transform(self):
106117
return transforms.IdentityTransform()
107118

108119
def get_antialiased(self):
120+
"""
121+
Returns True if the :class:`Patch` is to be drawn with antialiasing.
122+
"""
109123
return self._antialiased
110124
get_aa = get_antialiased
111125

112126
def get_edgecolor(self):
127+
"""
128+
Return the edge color of the :class:`Patch`.
129+
"""
113130
return self._edgecolor
114131
get_ec = get_edgecolor
115132

116133
def get_facecolor(self):
134+
"""
135+
Return the face color of the :class:`Patch`.
136+
"""
117137
return self._facecolor
118138
get_fc = get_facecolor
119139

120140
def get_linewidth(self):
141+
"""
142+
Return the line width in points.
143+
"""
121144
return self._linewidth
122145
get_lw = get_linewidth
123146

124147
def get_linestyle(self):
148+
"""
149+
Return the linestyle. Will be one of ['solid' | 'dashed' |
150+
'dashdot' | 'dotted']
151+
"""
125152
return self._linestyle
126153
get_ls = get_linestyle
127154

@@ -133,7 +160,10 @@ def set_antialiased(self, aa):
133160
"""
134161
if aa is None: aa = mpl.rcParams['patch.antialiased']
135162
self._antialiased = aa
136-
set_aa = set_antialiased
163+
164+
def set_aa(self, aa):
165+
"""alias for set_antialiased"""
166+
return self.set_antialiased(aa)
137167

138168
def set_edgecolor(self, color):
139169
"""
@@ -222,15 +252,18 @@ def set_hatch(self, h):
222252
223253
2. Hatching is done with solid black lines of width 0.
224254
255+
256+
ACCEPTS: [ '/' | '\\' | '|' | '-' | '#' | 'x' ]
225257
"""
226258
self._hatch = h
227259

228260
def get_hatch(self):
229-
'return the current hatching pattern'
261+
'Return the current hatching pattern'
230262
return self._hatch
231263

232264

233265
def draw(self, renderer):
266+
'Draw the :class:`Patch` to the given *renderer*.'
234267
if not self.get_visible(): return
235268
#renderer.open_group('patch')
236269
gc = renderer.new_gc()
@@ -378,8 +411,8 @@ def get_patch_transform(self):
378411

379412
class Rectangle(Patch):
380413
"""
381-
Draw a rectangle with lower left at *xy*=(*x*, *y*) with specified
382-
width and height
414+
Draw a rectangle with lower left at *xy* = (*x*, *y*) with
415+
specified *width* and *height*.
383416
"""
384417

385418
def __str__(self):
@@ -1296,13 +1329,11 @@ def draw_bbox(bbox, renderer, color='k', trans=None):
12961329

12971330
class BboxTransmuterBase(object):
12981331
"""
1299-
Bbox Transmuter Base class
1300-
1301-
BBoxTransmuterBase and its derivatives are used to make a fancy box
1302-
around a given rectangle. The __call__ method returns the Path of
1303-
the fancy box. This class is not an artist and actual drawing of the
1304-
fancy box is done by the :class:`FancyBboxPatch` class.
1305-
1332+
:class:`BBoxTransmuterBase` and its derivatives are used to make a
1333+
fancy box around a given rectangle. The :meth:`__call__` method
1334+
returns the :class:`~matplotlib.path.Path` of the fancy box. This
1335+
class is not an artist and actual drawing of the fancy box is done
1336+
by the :class:`FancyBboxPatch` class.
13061337
"""
13071338

13081339
# The derived classes are required to be able to be initialized
@@ -1317,11 +1348,12 @@ def __init__(self):
13171348

13181349
def transmute(self, x0, y0, width, height, mutation_size):
13191350
"""
1320-
The transmute method is a very core of the BboxTransmuter class
1321-
and must be overriden in the subclasses. It receives the
1322-
location and size of the rectangle, and the mutation_size, with
1323-
which the amound padding and etc. will be scaled. It returns a
1324-
Path instance.
1351+
The transmute method is a very core of the
1352+
:class:`BboxTransmuter` class and must be overriden in the
1353+
subclasses. It receives the location and size of the
1354+
rectangle, and the mutation_size, with which the amount of
1355+
padding and etc. will be scaled. It returns a
1356+
:class:`~matplotlib.path.Path` instance.
13251357
"""
13261358
raise NotImplementedError('Derived must override')
13271359

@@ -1501,7 +1533,8 @@ def __init__(self, xy, width, height,
15011533
mutation_aspect=None,
15021534
**kwargs):
15031535
"""
1504-
*xy*=lower left corner
1536+
*xy* = lower left corner
1537+
15051538
*width*, *height*
15061539
15071540
*boxstyle* describes how the fancy box will be drawn. It
@@ -1636,7 +1669,7 @@ def set_bbox_transmuter(self, bbox_transmuter):
16361669
"""
16371670
Set the transmuter object
16381671
1639-
ACCEPTS: BboxTransmuterBase (or its derivatives) instance
1672+
ACCEPTS: :class:`BboxTransmuterBase` (or its derivatives) instance
16401673
"""
16411674
self._bbox_transmuter = bbox_transmuter
16421675

lib/matplotlib/path.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
class Path(object):
1717
"""
18-
Path represents a series of possibly disconnected, possibly
19-
closed, line and curve segments.
18+
:class:`Path` represents a series of possibly disconnected,
19+
possibly closed, line and curve segments.
2020
2121
The underlying storage is made up of two parallel numpy arrays:
2222
- *vertices*: an Nx2 float array of vertices
@@ -159,8 +159,7 @@ def iter_segments(self, simplify=None):
159159
be simplified *only* if :attr:`should_simplify` is True, which
160160
is determined in the constructor by this criteria:
161161
162-
- No *codes* array
163-
- No nonfinite values
162+
- No curves
164163
- More than 128 vertices
165164
"""
166165
vertices = self.vertices
@@ -219,8 +218,9 @@ def transformed(self, transform):
219218
220219
.. seealso::
221220
:class:`matplotlib.transforms.TransformedPath`:
222-
A path class that will cache the transformed result
223-
and automatically update when the transform changes.
221+
A specialized path class that will cache the
222+
transformed result and automatically update when the
223+
transform changes.
224224
"""
225225
return Path(transform.transform(self.vertices), self.codes)
226226

@@ -265,8 +265,8 @@ def intersects_path(self, other, filled=True):
265265
Returns *True* if this path intersects another given path.
266266
267267
*filled*, when True, treats the paths as if they were filled.
268-
That is, if one path completely encloses the other,
269-
:meth:`intersects_path` will return True.
268+
That is, if one path completely encloses the other,
269+
:meth:`intersects_path` will return True.
270270
"""
271271
return path_intersects_path(self, other, filled)
272272

lib/matplotlib/projections/__init__.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,31 @@
33
from matplotlib import axes
44

55
class ProjectionRegistry(object):
6+
"""
7+
Manages the set of projections available to the system.
8+
"""
69
def __init__(self):
710
self._all_projection_types = {}
811

912
def register(self, *projections):
13+
"""
14+
Register a new set of projection(s).
15+
"""
1016
for projection in projections:
1117
name = projection.name
1218
self._all_projection_types[name] = projection
1319

1420
def get_projection_class(self, name):
21+
"""
22+
Get a projection class from its *name*.
23+
"""
1524
return self._all_projection_types[name]
1625

1726
def get_projection_names(self):
27+
"""
28+
Get a list of the names of all projections currently
29+
registered.
30+
"""
1831
names = self._all_projection_types.keys()
1932
names.sort()
2033
return names
@@ -31,7 +44,13 @@ def get_projection_names(self):
3144
def register_projection(cls):
3245
projection_registry.register(cls)
3346

34-
def get_projection_class(projection):
47+
def get_projection_class(projection=None):
48+
"""
49+
Get a projection class from its name.
50+
51+
If *projection* is None, a standard rectilinear projection is
52+
returned.
53+
"""
3554
if projection is None:
3655
projection = 'rectilinear'
3756

@@ -41,7 +60,24 @@ def get_projection_class(projection):
4160
raise ValueError("Unknown projection '%s'" % projection)
4261

4362
def projection_factory(projection, figure, rect, **kwargs):
63+
"""
64+
Get a new projection instance.
65+
66+
*projection* is a projection name.
67+
68+
*figure* is a figure to add the axes to.
69+
70+
*rect* is a :class:`~matplotlib.transforms.Bbox` object specifying
71+
the location of the axes within the figure.
72+
73+
Any other kwargs are passed along to the specific projection
74+
constructor being used.
75+
"""
76+
4477
return get_projection_class(projection)(figure, rect, **kwargs)
4578

4679
def get_projection_names():
80+
"""
81+
Get a list of acceptable projection names.
82+
"""
4783
return projection_registry.get_projection_names()

0 commit comments

Comments
 (0)