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

Skip to content

Commit 8553426

Browse files
committed
added cm and collections to api reference
svn path=/trunk/matplotlib/; revision=5551
1 parent 3275070 commit 8553426

3 files changed

Lines changed: 156 additions & 124 deletions

File tree

doc/api/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@
1616
axes_api.rst
1717
axis_api.rst
1818
cbook_api.rst
19+
cm_api.rst
20+
collections_api.rst
1921
pyplot_api.rst
2022
index_backend_api.rst

lib/matplotlib/cm.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
def get_cmap(name=None, lut=None):
1515
"""
16-
Get a colormap instance, defaulting to rc values if name is None
16+
Get a colormap instance, defaulting to rc values if *name* is None
1717
"""
1818
if name is None: name = mpl.rcParams['image.cmap']
1919
if lut is None: lut = mpl.rcParams['image.lut']
@@ -29,8 +29,9 @@ class ScalarMappable:
2929

3030
def __init__(self, norm=None, cmap=None):
3131
"""
32-
norm is a colors.normalize instance to map luminance to 0-1
33-
cmap is a cm colormap instance
32+
*norm* is an instance of :class:`colors.Normalize` or one of
33+
its subclasses, used to map luminance to 0-1. *cmap* is a
34+
:mod:`cm` colormap instance, for example :data:`cm.jet`
3435
"""
3536

3637
self.callbacksSM = cbook.CallbackRegistry((
@@ -50,10 +51,10 @@ def set_colorbar(self, im, ax):
5051
self.colorbar = im, ax
5152

5253
def to_rgba(self, x, alpha=1.0, bytes=False):
53-
'''Return a normalized rgba array corresponding to x.
54-
If x is already an rgb array, insert alpha; if it is
55-
already rgba, return it unchanged.
56-
If bytes is True, return rgba as 4 uint8s instead of 4 floats.
54+
'''Return a normalized rgba array corresponding to *x*. If *x*
55+
is already an rgb array, insert *alpha*; if it is already
56+
rgba, return it unchanged. If *bytes* is True, return rgba as
57+
4 uint8s instead of 4 floats.
5758
'''
5859
try:
5960
if x.ndim == 3:
@@ -79,7 +80,7 @@ def to_rgba(self, x, alpha=1.0, bytes=False):
7980
return x
8081

8182
def set_array(self, A):
82-
'Set the image array from numpy array A'
83+
'Set the image array from numpy array *A*'
8384
self._A = A
8485
self.update_dict['array'] = True
8586

@@ -97,8 +98,8 @@ def get_clim(self):
9798

9899
def set_clim(self, vmin=None, vmax=None):
99100
"""
100-
set the norm limits for image scaling; if vmin is a length2
101-
sequence, interpret it as (vmin, vmax) which is used to
101+
set the norm limits for image scaling; if *vmin* is a length2
102+
sequence, interpret it as ``(vmin, vmax)`` which is used to
102103
support setp
103104
104105
ACCEPTS: a length 2 sequence of floats

0 commit comments

Comments
 (0)