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

Skip to content

Commit 0e260f6

Browse files
committed
colorbar docstring improvements: work in progress
svn path=/trunk/matplotlib/; revision=6103
1 parent b5e37ec commit 0e260f6

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

lib/matplotlib/colorbar.py

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
a function for resizing an axes and adding a second axes
1414
suitable for a colorbar
1515
16-
The :meth:`matplotlib.Figure.colorbar` method uses :func:`make_axes`
17-
and :class:`Colorbar`; the :func:`matplotlib.pyplot.colorbar` function
18-
is a thin wrapper over :meth:`matplotlib.Figure.colorbar`.
16+
The :meth:`~matplotlib.figure.Figure.colorbar` method uses :func:`make_axes`
17+
and :class:`Colorbar`; the :func:`~matplotlib.pyplot.colorbar` function
18+
is a thin wrapper over :meth:`~matplotlib.figure.Figure.colorbar`.
1919
2020
'''
2121

@@ -94,7 +94,7 @@
9494
9595
Function signatures for the :mod:`~matplotlib.pyplot` interface; all
9696
but the first are also method signatures for the
97-
:meth:`matplotlib.Figure.colorbar` method::
97+
:meth:`~matplotlib.figure.Figure.colorbar` method::
9898
9999
colorbar(**kwargs)
100100
colorbar(mappable, **kwargs)
@@ -104,9 +104,10 @@
104104
arguments:
105105
106106
*mappable*
107-
the image, :class:`~matplotlib.contours.ContourSet`, etc. to
107+
the :class:`matplotlib.image.Image`,
108+
:class:`matplotlib.contour.ContourSet`, etc. to
108109
which the colorbar applies; this argument is mandatory for the
109-
:meth:`matplotlib.Figure.colorbar` method but optional for the
110+
:meth:`matplotlib.figure.Figure.colorbar` method but optional for the
110111
:func:`matplotlib.pyplot.colorbar` function, which sets the
111112
default to the current image.
112113
@@ -126,7 +127,7 @@
126127
colorbar properties:
127128
%s
128129
129-
If mappable is a :class:`~matplotlib.contours.ContourSet`, its *extend*
130+
If *mappable* is a :class:`~matplotlib.contours.ContourSet`, its *extend*
130131
kwarg is included automatically.
131132
132133
Note that the *shrink* kwarg provides a simple way to keep a vertical
@@ -138,6 +139,12 @@
138139
For more precise control, you can manually specify the positions of
139140
the axes objects in which the mappable and the colorbar are drawn. In
140141
this case, do not use any of the axes properties kwargs.
142+
143+
returns:
144+
:class:`Colorbar` instance; see also its base class,
145+
:class:`ColorbarBase`. Call the :meth:`set_label` method
146+
to label the colorbar
147+
141148
''' % (make_axes_kw_doc, colormap_kw_doc)
142149

143150

@@ -162,6 +169,19 @@ class ColorbarBase(cm.ScalarMappable):
162169
163170
norm=colors.NoNorm.
164171
172+
Useful attributes:
173+
174+
:attr:`ax`
175+
the Axes instance in which the colorbar is drawn
176+
177+
:attr:`lines`
178+
a LineCollection if lines were drawn, otherwise None
179+
180+
:attr:`dividers`
181+
a LineCollection if *drawedges* is True, otherwise None
182+
183+
Useful public methods are :meth:`set_label` and :meth:`add_lines`.
184+
165185
'''
166186
_slice_dict = {'neither': slice(0,1000000),
167187
'both': slice(1,-1),
@@ -196,6 +216,7 @@ def __init__(self, ax, cmap=None,
196216
self.filled = filled
197217
self.solids = None
198218
self.lines = None
219+
self.dividers = None
199220
self.set_label('')
200221
if cbook.iterable(ticks):
201222
self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
@@ -272,6 +293,9 @@ def _set_label(self):
272293
self.ax.set_xlabel(self._label, **self._labelkw)
273294

274295
def set_label(self, label, **kw):
296+
'''
297+
Label the long axis of the colorbar
298+
'''
275299
self._label = label
276300
self._labelkw = kw
277301
self._set_label()

0 commit comments

Comments
 (0)