Browse files

Tidied up some of the documentation.

  • Loading branch information...
1 parent 218b550 commit 401e9073e49972a976fd1e7597e5a0eb504fc73d @pelson pelson committed Apr 17, 2013
View
85 doc/_templates/index.html
@@ -1,34 +1,8 @@
{% extends "layout.html" %}
{% set title = 'matplotlib: python plotting' %}
-
{% block body %}
- <h1>John Hunter (1968-2012)</h1>
-
- <table bgcolor="#ddddff">
- <tr>
- <td>
- <img src="_static/John-hunter-crop-2.jpg"/>
- </td>
- <td>
- <p>
- On August 28 2012, John D. Hunter, the creator of matplotlib, died
- from complications arising from cancer treatment, after a brief but
- intense battle with this terrible illness. John is survived by his
- wife Miriam, his three daughters Rahel, Ava and Clara, his sisters
- Layne and Mary, and his mother Sarah.</p>
-
- <p>
- If you have benefited from John's many contributions, please say
- thanks in the way that would matter most to him. Please consider
- making a donation to
- the <a href="http://numfocus.org/johnhunter/">John Hunter Memorial
- Fund</a>.</p>
- </td>
-</tr>
-</table>
-
<h1>Introduction</h1>
<p>matplotlib is a python 2D plotting library which produces
@@ -66,6 +40,32 @@
properties, axes properties, etc, via an object oriented interface
or via a set of functions familiar to MATLAB users.</p>
+<div style="float: right; min-width: 450px; width: 50%; padding-left: 5%;">
+ <h1>John Hunter (1968-2012)</h1>
+ <table bgcolor="#ddddff">
+ <tr>
+ <td>
+ <img src="_static/John-hunter-crop-2.jpg" align="left" />
+ </td>
+ <td>
+ <p>
+ On August 28 2012, John D. Hunter, the creator of matplotlib, died
+ from complications arising from cancer treatment, after a brief but
+ intense battle with this terrible illness. John is survived by his
+ wife Miriam, his three daughters Rahel, Ava and Clara, his sisters
+ Layne and Mary, and his mother Sarah.</p>
+
+ <p>
+ If you have benefited from John's many contributions, please say
+ thanks in the way that would matter most to him. Please consider
+ making a donation to
+ the <a href="http://numfocus.org/johnhunter/">John Hunter Memorial
+ Fund</a>.</p>
+ </td>
+ </tr>
+ </table>
+</div>
+
<h1>Download</h1>
Visit the
@@ -143,30 +143,31 @@
<h1>Citing matplotlib</h1>
<p>
- matplotlib is the brainchild of John Hunter (1968-2012), who has put an
- inordinate amount of effort into producing a piece of software utilized by
- thousands of scientists worldwide.
+ matplotlib is the brainchild of John Hunter (1968-2012), who, along with its many
+ contributors, have put an immeasurable amount of time and effort into producing a
+ piece of software utilized by thousands of scientists worldwide.
If matplotlib contributes to a project that leads to a scientific publication,
- please acknowledge this fact by citing the project. You can use this
+ please acknowledge this work by citing the project. You can use this
<a href="{{ pathto('citing') }}">ready-made citation entry</a>.
</p>
<h1>Open source</h1>
-<p>Please
-consider <a href="http://sourceforge.net/project/project_donations.php?group_id=80706">donating</a>
-to support matplotlib development or to
-the <a href="http://numfocus.org/johnhunter/">John Hunter Memorial
-Fund</a>.</p>
+<p>
+Please consider <a href="http://sourceforge.net/project/project_donations.php?group_id=80706">donating</a>
+to support matplotlib development or to the <a href="http://numfocus.org/johnhunter/">John Hunter Memorial Fund</a>.
+</p>
-<p>The matplotlib <a href="{{ pathto('users/license') }}">license</a>
-is based on the Python Software Foundation
-<a href="http://www.python.org/psf/license">(PSF)</a> license.</p>
+<p>
+The matplotlib <a href="{{ pathto('users/license') }}">license</a> is based on the Python Software Foundation
+<a href="http://www.python.org/psf/license">(PSF)</a> license.
+</p>
-<p>There is an active developer community and a long list of people
-who have made significant <a href="{{ pathto('users/credits')
-}}">contributions</a>.</p>
+<p>
+There is an active developer community and a long list of people
+who have made significant <a href="{{ pathto('users/credits') }}">contributions</a>.
+</p>
<div class="footnote"><p>
@@ -178,6 +179,4 @@
Mathematica is a registered trademark of Wolfram Research, Inc.
</p>
-
-
{% endblock %}
View
1 doc/_templates/layout.html
@@ -38,6 +38,7 @@
<li><a href="{{ pathto('search') }}">search</a>|&nbsp;</li>
<li><a href="{{ pathto('examples/index') }}">examples</a>|&nbsp;</li>
<li><a href="{{ pathto('gallery') }}">gallery</a>|&nbsp;</li>
+ <li><a href="{{ pathto('api/pyplot_summary') }}">pyplot</a>|&nbsp;</li>
<li><a href="{{ pathto('citing') }}">citation</a>|&nbsp;</li>
<li><a href="{{ pathto('contents') }}">docs</a> &raquo;</li>
{% endblock %}
View
1 doc/api/cm_api.rst
@@ -2,7 +2,6 @@
cm (colormap)
*************
-
:mod:`matplotlib.cm`
====================
View
3 doc/api/colors_api.rst
@@ -2,6 +2,9 @@
colors
******
+For a plot showing the available matplotlib colormaps see the
+:ref:`colormap <pylab_examples-show_colormaps>` example.
+
:mod:`matplotlib.colors`
========================
View
11 doc/api/matplotlib_configuration_api.rst
@@ -1,13 +1,8 @@
-*************
-configuration
-*************
-
-
-:mod:`matplotlib`
-=================
+The top level :mod:`matplotlib` module
+======================================
.. automodule:: matplotlib
:members: rc, rcdefaults, use
+ :members:
:undoc-members:
:show-inheritance:
-
View
12 doc/api/nxutils_api.rst
@@ -1,12 +0,0 @@
-*******
-nxutils
-*******
-
-:mod:`matplotlib.nxutils`
-===========================
-
-.. automodule:: matplotlib.nxutils
- :members:
- :undoc-members:
- :show-inheritance:
-
View
42 doc/mpl_toolkits/index.rst
@@ -22,13 +22,31 @@ Toolkits are collections of application-specific functions that extend matplotli
.. _toolkit_basemap:
-Basemap
-=======
+Basemap (*Not distributed with matplotlib*)
+============================================
Plots data on map projections, with continental and political
-boundaries, see `basemap <http://matplotlib.github.com/basemap>`_
+boundaries, see `basemap <http://matplotlib.org/basemap>`_
docs.
+.. image:: http://matplotlib.org/basemap/_images/contour1.png
+ :height: 400px
+
+
+
+Cartopy (*Not distributed with matplotlib*)
+============================================
+An alternative mapping library written for matplotlib ``v1.2`` and beyond.
+`Cartopy <http://scitools.org.uk/cartopy/docs/latest>`_ builds on top of
+matplotlib to provide object oriented map projection definitions and close
+integration with Shapely for powerful yet easy-to-use vector data processing
+tools. An example plot from the
+`Cartopy gallery <http://scitools.org.uk/cartopy/docs/latest/gallery.html>`_:
+
+.. image:: http://scitools.org.uk/cartopy/docs/latest/_images/hurricane_katrina_01_00.png
+ :height: 400px
+
+
.. _toolkit_gtk:
GTK Tools
@@ -38,6 +56,7 @@ mpl_toolkits.gtktools provides some utilities for working with GTK.
This toolkit ships with matplotlib, but requires `pygtk
<http://www.pygtk.org/>`_.
+
.. _toolkit_excel:
Excel Tools
@@ -47,38 +66,39 @@ mpl_toolkits.exceltools provides some utilities for working with
Excel. This toolkit ships with matplotlib, but requires
`xlwt <http://pypi.python.org/pypi/xlwt>`_
+
.. _toolkit_natgrid:
-Natgrid
-========
+Natgrid (*Not distributed with matplotlib*)
+===========================================
mpl_toolkits.natgrid is an interface to natgrid C library for gridding
irregularly spaced data. This requires a separate installation of the
natgrid toolkit from the sourceforge `download
<http://sourceforge.net/project/showfiles.php?group_id=80706&package_id=142792>`_
page.
+
.. _toolkit_mplot3d:
mplot3d
===========
-mpl_toolkits.mplot3d provides some basic 3D plotting (scatter, surf,
+:ref:`mpl_toolkits.mplot3d <toolkit_mplot3d-index>` provides some basic 3D plotting (scatter, surf,
line, mesh) tools. Not the fastest or feature complete 3D library out
there, but ships with matplotlib and thus may be a lighter weight
solution for some use cases.
-See :ref:`toolkit_mplot3d-index` for more documentation and examples.
+.. image:: /_images/contourf3d_demo21.png
+
.. _toolkit_axes_grid:
AxesGrid
========
-The matplotlib AxesGrid toolkit is a collection of helper classes to
+The matplotlib :ref:`AxesGrid <toolkit_axesgrid-index>` toolkit is a collection of helper classes to
ease displaying multiple images in matplotlib. The AxesGrid toolkit is
distributed with matplotlib source.
-.. image:: ../_static/demo_axes_grid.png
-
-See :ref:`toolkit_axesgrid-index` for documentations.
+.. image:: /_static/demo_axes_grid.png
View
6 examples/pylab_examples/marker_path.py
@@ -5,9 +5,9 @@
star = mpath.Path.unit_regular_star(6)
circle = mpath.Path.unit_circle()
-# concatenate the star with an internal cutout of the circle
-verts = np.concatenate([star.vertices, circle.vertices[::-1, ...]])
-codes = np.concatenate([star.codes, circle.codes])
+# concatenate the circle with an internal cutout of the star
+verts = np.concatenate([circle.vertices, star.vertices[::-1, ...]])
+codes = np.concatenate([circle.codes, star.codes])
cut_star = mpath.Path(verts, codes)
View
65 examples/pylab_examples/pcolor_demo.py
@@ -1,28 +1,57 @@
-#!/usr/bin/env python
"""
-See pcolor_demo2 for an alternative way of generating pcolor plots
-using imshow that is likely faster for large grids
+Demonstrates similarities between pcolor, pcolormesh, imshow and pcolorfast
+for drawing quadrilateral grids.
+
"""
-from __future__ import division
-from matplotlib.patches import Patch
-from pylab import *
+import matplotlib.pyplot as plt
+import numpy as np
-def func3(x,y):
- return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
+# make these smaller to increase the resolution
+dx, dy = 0.15, 0.05
+# generate 2 2d grids for the x & y bounds
+y, x = np.mgrid[slice(-3, 3 + dy, dy),
+ slice(-3, 3 + dx, dx)]
+z = (1 - x / 2. + x ** 5 + y ** 3) * np.exp(-x ** 2 - y ** 2)
+# x and y are bounds, so z should be the value *inside* those bounds.
+# Therefore, remove the last value from the z array.
+z = z[:-1, :-1]
+z_min, z_max = -np.abs(z).max(), np.abs(z).max()
+
+
+
+plt.subplot(2, 2, 1)
+plt.pcolor(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max)
+plt.title('pcolor')
+# set the limits of the plot to the limits of the data
+plt.axis([x.min(), x.max(), y.min(), y.max()])
+plt.colorbar()
+
+
+
+plt.subplot(2, 2, 2)
+plt.pcolormesh(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max)
+plt.title('pcolormesh')
+# set the limits of the plot to the limits of the data
+plt.axis([x.min(), x.max(), y.min(), y.max()])
+plt.colorbar()
+
+
+
+plt.subplot(2, 2, 3)
+plt.imshow(z, cmap='RdBu', vmin=z_min, vmax=z_max,
+ extent=[x.min(), x.max(), y.min(), y.max()],
+ interpolation='nearest', origin='lower')
+plt.title('image (interp. nearest)')
+plt.colorbar()
-# make these smaller to increase the resolution
-dx, dy = 0.05, 0.05
-x = arange(-3.0, 3.0001, dx)
-y = arange(-3.0, 3.0001, dy)
-X,Y = meshgrid(x, y)
-Z = func3(X, Y)
-pcolor(X, Y, Z, cmap=cm.RdBu, vmax=abs(Z).max(), vmin=-abs(Z).max())
-colorbar()
-axis([-3,3,-3,3])
+ax = plt.subplot(2, 2, 4)
+ax.pcolorfast(x, y, z, cmap='RdBu', vmin=z_min, vmax=z_max)
+plt.title('pcolorfast')
+plt.colorbar()
-show()
+plt.show()
View
31 examples/pylab_examples/pcolor_demo2.py
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-"""
-See pcolor_demo2 for a much faster way of generating pcolor plots
-"""
-from __future__ import division
-from pylab import *
-
-def func3(x,y):
- return (1- x/2 + x**5 + y**3)*exp(-x**2-y**2)
-
-
-# make these smaller to increase the resolution
-dx, dy = 0.05, 0.05
-
-x = arange(-3.0, 3.0, dx)
-y = arange(-3.0, 3.0, dy)
-X,Y = meshgrid(x, y)
-
-Z = func3(X, Y)
-
-
-ax = subplot(111)
-im = imshow(Z, cmap=cm.RdBu, vmax=abs(Z).max(), vmin=-abs(Z).max())
-#im.set_interpolation('nearest')
-#im.set_interpolation('bicubic')
-im.set_interpolation('bilinear')
-#ax.set_image_extent(-3, 3, -3, 3)
-
-show()
-
-
View
26 examples/pylab_examples/pcolor_log.py
@@ -1,27 +1,25 @@
-from pylab import *
-
+import matplotlib.pyplot as plt
from matplotlib.colors import LogNorm
+import numpy as np
+from matplotlib.mlab import bivariate_normal
N = 100
-x = linspace(-3.0, 3.0, N)
-y = linspace(-2.0, 2.0, N)
-
-X, Y = meshgrid(x, y)
+X, Y = np.mgrid[-3:3:complex(0, N), -2:2:complex(0, N)]
# A low hump with a spike coming out of the top right.
# Needs to have z/colour axis on a log scale so we see both hump and spike.
# linear scale only shows the spike.
-Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1*bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
+Z1 = bivariate_normal(X, Y, 0.1, 0.2, 1.0, 1.0) + 0.1 * bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0)
-subplot(2,1,1)
-pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()), cmap=cm.PuBu_r)
-colorbar()
+plt.subplot(2,1,1)
+plt.pcolor(X, Y, Z1, norm=LogNorm(vmin=Z1.min(), vmax=Z1.max()), cmap='PuBu_r')
+plt.colorbar()
-subplot(2,1,2)
-pcolor(X, Y, Z1, cmap=cm.PuBu_r)
-colorbar()
+plt.subplot(2,1,2)
+plt.pcolor(X, Y, Z1, cmap='PuBu_r')
+plt.colorbar()
-show()
+plt.show()
View
19 examples/pylab_examples/pcolor_small.py
@@ -1,15 +1,14 @@
-#!/usr/bin/env python
-
-from pylab import *
+import matplotlib.pyplot as plt
+from numpy.random import rand
Z = rand(6,10)
-subplot(2,1,1)
-c = pcolor(Z)
-title('default: no edges')
+plt.subplot(2,1,1)
+c = plt.pcolor(Z)
+plt.title('default: no edges')
-subplot(2,1,2)
-c = pcolor(Z, edgecolors='k', linewidths=4)
-title('thick edges')
+plt.subplot(2,1,2)
+c = plt.pcolor(Z, edgecolors='k', linewidths=4)
+plt.title('thick edges')
-show()
+plt.show()
View
30 examples/pylab_examples/pie_demo2.py
@@ -1,41 +1,39 @@
"""
Make a pie charts of varying size - see
-http://matplotlib.sf.net/matplotlib.pylab.html#-pie for the docstring.
+http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.pie for the docstring.
This example shows a basic pie charts with labels optional features,
like autolabeling the percentage, offsetting a slice with "explode"
and adding a shadow, in different sizes.
"""
-from pylab import *
+import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
# Some data
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
-fracs = [15,30,45, 10]
+fracs = [15, 30, 45, 10]
explode=(0, 0.05, 0, 0)
# Make square figures and axes
the_grid = GridSpec(2, 2)
-figure(1, figsize=(6,6))
+plt.subplot(the_grid[0, 0], aspect=1)
-subplot(the_grid[0, 0])
+plt.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True)
-pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True)
+plt.subplot(the_grid[0, 1], aspect=1)
-subplot(the_grid[0, 1])
+plt.pie(fracs, explode=explode, labels=labels, autopct='%.0f%%', shadow=True)
-pie(fracs, explode=explode, labels=labels, autopct='%.0f%%', shadow=True)
+plt.subplot(the_grid[1, 0], aspect=1)
-subplot(the_grid[1, 0])
-
-patches, texts, autotexts = pie(fracs, labels=labels,
- autopct='%.0f%%',
- shadow=True, radius=0.5)
+patches, texts, autotexts = plt.pie(fracs, labels=labels,
+ autopct='%.0f%%',
+ shadow=True, radius=0.5)
# Make the labels on the small plot easier to read.
for t in texts:
@@ -44,9 +42,9 @@
t.set_size('x-small')
autotexts[0].set_color('y')
-subplot(the_grid[1, 1])
+plt.subplot(the_grid[1, 1], aspect=1)
-patches, texts, autotexts = pie(fracs, explode=explode,
+patches, texts, autotexts = plt.pie(fracs, explode=explode,
labels=labels, autopct='%.0f%%',
shadow=False, radius=0.5)
# Turn off shadow for tiny plot
@@ -57,4 +55,4 @@
t.set_size('x-small')
autotexts[0].set_color('y')
-show()
+plt.show()
View
1 examples/tests/backend_driver.py
@@ -210,7 +210,6 @@
'nan_test.py',
'newscalarformatter_demo.py',
'pcolor_demo.py',
- 'pcolor_demo2.py',
'pcolor_log.py',
'pcolor_small.py',
'pie_demo2.py',
View
7 lib/matplotlib/artist.py
@@ -752,10 +752,7 @@ def findobj(self, match=None, include_self=True):
"""
Find artist objects.
- pyplot signature:
- findobj(o=gcf(), match=None, include_self=True)
-
- Recursively find all :class:matplotlib.artist.Artist instances
+ Recursively find all :class:`~matplotlib.artist.Artist` instances
contained in self.
*match* can be
@@ -770,9 +767,7 @@ def findobj(self, match=None, include_self=True):
If *include_self* is True (default), include self in the list to be
checked for a match.
- .. plot:: mpl_examples/pylab_examples/findobj_demo.py
"""
-
if match is None: # always return True
def matchfunc(x):
return True
View
6 lib/matplotlib/axes.py
@@ -5360,11 +5360,15 @@ def pie(self, x, explode=None, labels=None, colors=None,
The radius of the pie, if *radius* is *None* it will be set to 1.
The pie chart will probably look best if the figure and axes are
- square. e.g.::
+ square, or the Axes aspect is equal. e.g.::
figure(figsize=(8,8))
ax = axes([0.1, 0.1, 0.8, 0.8])
+ or::
+
+ axes(aspect=1)
+
Return value:
If *autopct* is *None*, return the tuple (*patches*, *texts*):
View
17 lib/matplotlib/cm.py
@@ -102,12 +102,12 @@ def register_cmap(name=None, cmap=None, data=None, lut=None):
register_cmap(name='choppy', data=choppydata, lut=128)
- In the first case, *cmap* must be a :class:`colors.Colormap`
+ In the first case, *cmap* must be a :class:`matplotlib.colors.Colormap`
instance. The *name* is optional; if absent, the name will
- be the :attr:`name` attribute of the *cmap*.
+ be the :attr:`~matplotlib.colors.Colormap.name` attribute of the *cmap*.
In the second case, the three arguments are passed to
- the :class:`colors.LinearSegmentedColormap` initializer,
+ the :class:`~matplotlib.colors.LinearSegmentedColormap` initializer,
and the resulting colormap is registered.
"""
@@ -136,9 +136,9 @@ def get_cmap(name=None, lut=None):
Get a colormap instance, defaulting to rc values if *name* is None.
Colormaps added with :func:`register_cmap` take precedence over
- builtin colormaps.
+ built-in colormaps.
- If *name* is a :class:`colors.Colormap` instance, it will be
+ If *name* is a :class:`matplotlib.colors.Colormap` instance, it will be
returned.
If *lut* is not None it must be an integer giving the number of
@@ -169,9 +169,10 @@ class ScalarMappable:
def __init__(self, norm=None, cmap=None):
"""
- *norm* is an instance of :class:`colors.Normalize` or one of
- its subclasses, used to map luminance to 0-1. *cmap* is a
- :mod:`cm` colormap instance, for example :data:`cm.jet`
+ *norm* is an instance of :class:`matplotlib.colors.Normalize` or
+ one of its subclasses, used to map luminance to 0-1. *cmap* is a
+ :mod:`~matplotlib.cm.Colormap` instance, for example
+ :data:`matplotlib.cm.jet`.
"""
self.callbacksSM = cbook.CallbackRegistry()
View
68 lib/matplotlib/colors.py
@@ -19,8 +19,8 @@
:class:`ColorConverter` class providing methods for converting single color
specifications or sequences of them to *RGB* or *RGBA*.
-Commands which take color arguments can use several formats to specify the
-colors. For the basic builtin colors, you can use a single letter
+Commands which take color arguments can use several formats to specify
+the colors. For the basic built-in colors, you can use a single letter
- b: blue
- g: green
@@ -477,19 +477,23 @@ def makeMappingArray(N, data, gamma=1.0):
class Colormap(object):
- """Base class for all scalar to rgb mappings
+ """
+ Baseclass for all scalar to RGBA mappings.
- Important methods:
+ Typically Colormap instances are used to convert data values (floats) from
+ the interval ``[0, 1]`` to the RGBA color that the respective Colormap
+ represents. For scaling of data into the ``[0, 1]`` interval see
+ :class:`matplotlib.colors.Normalize`.
- * :meth:`set_bad`
- * :meth:`set_under`
- * :meth:`set_over`
"""
def __init__(self, name, N=256):
"""
- Public class attributes:
- :attr:`N` : number of rgb quantization levels
- :attr:`name` : name of colormap
+ Parameters
+
+ name : str
+ The name of the colormap.
+ N : int
+ The number of rgb quantization levels.
"""
self.name = name
@@ -502,20 +506,32 @@ def __init__(self, name, N=256):
self._i_bad = N + 2
self._isinit = False
- # FIXME FIXME FIXME bytes is a *keyword* in python
def __call__(self, X, alpha=None, bytes=False):
"""
- *X* is either a scalar or an array (of any dimension).
- If scalar, a tuple of rgba values is returned, otherwise
- an array with the new shape = oldshape+(4,). If the X-values
- are integers, then they are used as indices into the array.
- If they are floating point, then they must be in the
- interval (0.0, 1.0).
- Alpha must be a scalar between 0 and 1, or None.
- If bytes is False, the rgba values will be floats on a
- 0-1 scale; if True, they will be uint8, 0-255.
- """
+ Parameters:
+
+ X : scalar, ndarray
+ The data value(s) to convert to RGBA.
+ For floats, X should be in the interval ``[0.0, 1.0]`` to
+ return the RGBA values ``X*100`` percent along the Colormap line.
+ For integers, X should be in the interval ``[0, Colormap.N)`` to
+ return RGBA values *indexed* from the Colormap with index ``X``.
+
+ alpha : float, None
+ Alpha must be a scalar between 0 and 1, or None.
+
+ bytes : bool
+ If False (default), the returned RGBA values will be floats in the
+ interval ``[0, 1]`` otherwise they will be uint8s in the interval
+ ``[0, 255]``.
+ Returns:
+
+ Tuple of RGBA values if X is scalar, othewise an array of
+ RGBA values with a shape of ``X.shape + (4, )``.
+
+ """
+ # See class docstring for arg/kwarg documentation.
if not self._isinit:
self._init()
mask_bad = None
@@ -690,8 +706,8 @@ def __init__(self, name, segmentdata, N=256, gamma=1.0):
:func:`makeMappingArray`
For information about making a mapping array.
"""
- self.monochrome = False # True only if all colors in map are
- # identical; needed for contouring.
+ # True only if all colors in map are identical; needed for contouring.
+ self.monochrome = False
Colormap.__init__(self, name, N)
self._segmentdata = segmentdata
self._gamma = gamma
@@ -762,7 +778,7 @@ def __init__(self, colors, name='from_list', N=None):
*colors*
a list of matplotlib color specifications,
- or an equivalent Nx3 or Nx4 floating point array
+ or an equivalent Nx3 or Nx4 floating point array
(*N* rgb or rgba values)
*name*
a string to identify the colormap
@@ -815,7 +831,9 @@ def _init(self):
class Normalize(object):
"""
- Normalize a given value to the 0-1 range
+ A class which, when called, can normalize data into
+ the ``[0, 1]`` interval.
+
"""
def __init__(self, vmin=None, vmax=None, clip=False):
"""
View
21 lib/matplotlib/pyplot.py
@@ -102,10 +102,10 @@ def _backend_selection():
@docstring.copy_dedent(Artist.findobj)
-def findobj(o=None, match=None):
+def findobj(o=None, match=None, include_self=True):
if o is None:
o = gcf()
- return o.findobj(match)
+ return o.findobj(match, include_self=include_self)
def switch_backend(newbackend):
@@ -1253,7 +1253,9 @@ def title(s, *args, **kwargs):
def axis(*v, **kwargs):
"""
- Set or get the axis properties.::
+ Convenience method to get or set axis properties.
+
+ Calling with no arguments::
>>> axis()
@@ -1754,8 +1756,8 @@ def colors():
def colormaps():
"""
Matplotlib provides a number of colormaps, and others can be added using
- :func:`register_cmap`. This function documents the built-in colormaps,
- and will also return a list of all registered colormaps if called.
+ :func:`~matplotlib.cm.register_cmap`. This function documents the built-in
+ colormaps, and will also return a list of all registered colormaps if called.
You can set the colormap for an image, pcolor, scatter, etc,
using a keyword argument::
@@ -2086,15 +2088,16 @@ def clim(vmin=None, vmax=None):
def set_cmap(cmap):
- '''
+ """
Set the default colormap. Applies to the current image if any.
See help(colormaps) for more information.
- *cmap* must be a :class:`colors.Colormap` instance, or
+ *cmap* must be a :class:`~matplotlib.colors.Colormap` instance, or
the name of a registered colormap.
- See :func:`register_cmap` and :func:`get_cmap`.
- '''
+ See :func:`matplotlib.cm.register_cmap` and
+ :func:`matplotlib.cm.get_cmap`.
+ """
cmap = cm.get_cmap(cmap)
rc('image', cmap=cmap.name)

0 comments on commit 401e907

Please sign in to comment.