 boilerplate.py               |  168 ------
 lib/matplotlib/decorator.py  |  209 +++++++
 lib/matplotlib/pyplot.py     | 1327 +++++-------------------------------------
 license/LICENSE_DECORATOR_PY |   26 +
 4 files changed, 369 insertions(+), 1361 deletions(-)

diff --git a/boilerplate.py b/boilerplate.py
deleted file mode 100644
index 92936ba..0000000
--- a/boilerplate.py
+++ /dev/null
@@ -1,168 +0,0 @@
-# wrap the plot commands defined in axes.  The code generated by this
-# file is pasted into pylab.py.  We did try to do this the smart way,
-# with callable functions and new.function, but could never get the
-# docstrings right for python2.2.  See
-# http://groups.google.com/group/comp.lang.python/browse_frm/thread/dcd63ec13096a0f6/1b14640f3a4ad3dc?#1b14640f3a4ad3dc
-
-
-# note we check for __doc__ is not None since py2exe optimize removes
-# the docstrings
-
-_fmtplot = """\
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def %(func)s(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().%(func)s(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    %(mappable)s
-    hold(b)
-    return ret
-if Axes.%(func)s.__doc__ is not None:
-    %(func)s.__doc__ = dedent(Axes.%(func)s.__doc__) + \"\"\"
-
-Additional kwargs: hold = [True|False] overrides default hold state\"\"\"
-"""
-
-_fmtmisc = """\
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def %(func)s(*args, **kwargs):
-
-    ret =  gca().%(func)s(*args, **kwargs)
-    draw_if_interactive()
-    return ret
-if Axes.%(func)s.__doc__ is not None:
-    %(func)s.__doc__ = dedent(Axes.%(func)s.__doc__)
-"""
-
-# these methods are all simple wrappers of Axes methods by the same
-# name.
-_plotcommands = (
-    'acorr',
-    'arrow',
-    'axhline',
-    'axhspan',
-    'axvline',
-    'axvspan',
-    'bar',
-    'barh',
-    'broken_barh',
-    'boxplot',
-    'cohere',
-    'clabel',
-    'contour',
-    'contourf',
-    'csd',
-    'errorbar',
-    'fill',
-    'fill_between',
-    'fill_betweenx',
-    'hexbin',
-    'hist',
-    'hlines',
-    'imshow',
-    'loglog',
-    'pcolor',
-    'pcolormesh',
-    'pie',
-    'plot',
-    'plot_date',
-    'psd',
-    'quiver',
-    'quiverkey',
-    'scatter',
-    'semilogx',
-    'semilogy',
-    'specgram',
-    'spy',
-    'stem',
-    'step',
-    'vlines',
-    'xcorr',
-    'barbs',
-    )
-
-_misccommands = (
-    'cla',
-    'grid',
-    'legend',
-    'table',
-    'text',
-    'annotate',
-    )
-
-cmappable = {
-    'contour' : 'if ret._A is not None: gci._current = ret',
-    'contourf': 'if ret._A is not None: gci._current = ret',
-    'hexbin' : 'gci._current = ret[0]',
-    'scatter' : 'gci._current = ret',
-    'pcolor'  : 'gci._current = ret',
-    'pcolormesh'  : 'gci._current = ret',
-    'imshow'  : 'gci._current = ret',
-    'spy'    : 'gci._current = ret',
-    'quiver' : 'gci._current = ret',
-    'specgram'  : 'gci._current = ret[-1]',
-
-}
-
-
-for func in _plotcommands:
-    if func in cmappable:
-        mappable = cmappable[func]
-    else:
-        mappable = ''
-    print _fmtplot%locals()
-
-
-for func in _misccommands:
-    print _fmtmisc%locals()
-
-
-
-# define the colormap functions
-_fmtcmap = """\
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def %(name)s():
-    '''
-    set the default colormap to %(name)s and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='%(name)s')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.%(name)s)
-    draw_if_interactive()
-
-"""
-
-cmaps = (
-    'autumn',
-    'bone',
-    'cool',
-    'copper',
-    'flag',
-    'gray' ,
-    'hot',
-    'hsv',
-    'jet' ,
-    'pink',
-    'prism',
-    'spring',
-    'summer',
-    'winter',
-    'spectral'
-)
-# add all the colormaps (autumn, hsv, ....)
-for name in cmaps:
-    print _fmtcmap%locals()
diff --git a/lib/matplotlib/decorator.py b/lib/matplotlib/decorator.py
new file mode 100644
index 0000000..d775a67
--- /dev/null
+++ b/lib/matplotlib/decorator.py
@@ -0,0 +1,209 @@
+##########################     LICENCE     ###############################
+      
+##   Redistributions of source code must retain the above copyright 
+##   notice, this list of conditions and the following disclaimer.
+##   Redistributions in bytecode form must reproduce the above copyright
+##   notice, this list of conditions and the following disclaimer in
+##   the documentation and/or other materials provided with the
+##   distribution. 
+
+##   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+##   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+##   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+##   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+##   HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+##   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+##   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+##   OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+##   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+##   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+##   DAMAGE.
+
+"""
+Decorator module, see http://pypi.python.org/pypi/decorator
+for the documentation.
+"""
+
+__all__ = ["decorator", "FunctionMaker", "deprecated", "getinfo", "new_wrapper"]
+
+import os, sys, re, inspect, warnings
+
+DEF = re.compile('\s*def\s*([_\w][_\w\d]*)\s*\(')
+
+# basic functionality
+class FunctionMaker(object):
+    """
+    An object with the ability to create functions with a given signature.
+    It has attributes name, doc, module, signature, defaults, dict and
+    methods update and make.
+    """
+    def __init__(self, func=None, name=None, signature=None,
+                 defaults=None, doc=None, module=None, funcdict=None):
+        if func:
+            # func can also be a class or a callable, but not an instance method
+            self.name = func.__name__
+            if self.name == '<lambda>': # small hack for lambda functions
+                self.name = '_lambda_' 
+            self.doc = func.__doc__
+            self.module = func.__module__
+            if inspect.isfunction(func):
+                self.signature = inspect.formatargspec(
+                    formatvalue=lambda val: "", *inspect.getargspec(func))[1:-1]
+                self.defaults = func.func_defaults
+                self.dict = func.__dict__.copy()
+        if name:
+            self.name = name
+        if signature is not None:
+            self.signature = signature
+        if defaults:
+            self.defaults = defaults
+        if doc:
+            self.doc = doc
+        if module:
+            self.module = module
+        if funcdict:
+            self.dict = funcdict
+        # check existence required attributes
+        assert hasattr(self, 'name')
+        if not hasattr(self, 'signature'):
+            raise TypeError('You are decorating a non function: %s' % func)
+
+    def update(self, func, **kw):
+        "Update the signature of func with the data in self"
+        func.__name__ = self.name
+        func.__doc__ = getattr(self, 'doc', None)
+        func.__dict__ = getattr(self, 'dict', {})
+        func.func_defaults = getattr(self, 'defaults', None)
+        callermodule = sys._getframe(3).f_globals.get('__name__', '?')
+        func.__module__ = getattr(self, 'module', callermodule)
+        func.__dict__.update(kw)
+ 
+    def make(self, src_templ, evaldict=None, addsource=False, **attrs):
+        "Make a new function from a given template and update the signature"
+        src = src_templ % vars(self) # expand name and signature
+        evaldict = evaldict or {}
+        mo = DEF.match(src)
+        if mo is None:
+            raise SyntaxError('not a valid function template\n%s' % src)
+        name = mo.group(1) # extract the function name
+        reserved_names = set([name] + [
+            arg.strip(' *') for arg in self.signature.split(',')])
+        for n, v in evaldict.iteritems():
+            if n in reserved_names:
+                raise NameError('%s is overridden in\n%s' % (n, src))
+        if not src.endswith('\n'): # add a newline just for safety
+            src += '\n'
+        try:
+            code = compile(src, '<string>', 'single')
+            exec code in evaldict
+        except:
+            print >> sys.stderr, 'Error in generated code:'
+            print >> sys.stderr, src
+            raise
+        func = evaldict[name]
+        if addsource:
+            attrs['__source__'] = src
+        self.update(func, **attrs)
+        return func
+
+def decorator(caller, func=None):
+    """
+    decorator(caller) converts a caller function into a decorator;
+    decorator(caller, func) decorates a function using a caller.
+    """
+    if func is None: # returns a decorator
+        fun = FunctionMaker(caller)
+        first_arg = inspect.getargspec(caller)[0][0]
+        src = 'def %s(%s): return _call_(caller, %s)' % (
+            caller.__name__, first_arg, first_arg)
+        return fun.make(src, dict(caller=caller, _call_=decorator),
+                        undecorated=caller)
+    else: # returns a decorated function
+        fun = FunctionMaker(func)
+        src = """def %(name)s(%(signature)s):
+    return _call_(_func_, %(signature)s)"""
+        return fun.make(src, dict(_func_=func, _call_=caller), undecorated=func)
+
+###################### deprecated functionality #########################
+
+@decorator
+def deprecated(func, *args, **kw):
+    "A decorator for deprecated functions"
+    warnings.warn(
+        ('Calling the deprecated function %r\n'
+         'Downgrade to decorator 2.3 if you want to use this functionality')
+        % func.__name__, DeprecationWarning, stacklevel=3)
+    return func(*args, **kw)
+
+@deprecated
+def getinfo(func):
+    """
+    Returns an info dictionary containing:
+    - name (the name of the function : str)
+    - argnames (the names of the arguments : list)
+    - defaults (the values of the default arguments : tuple)
+    - signature (the signature : str)
+    - doc (the docstring : str)
+    - module (the module name : str)
+    - dict (the function __dict__ : str)
+    
+    >>> def f(self, x=1, y=2, *args, **kw): pass
+
+    >>> info = getinfo(f)
+
+    >>> info["name"]
+    'f'
+    >>> info["argnames"]
+    ['self', 'x', 'y', 'args', 'kw']
+    
+    >>> info["defaults"]
+    (1, 2)
+
+    >>> info["signature"]
+    'self, x, y, *args, **kw'
+    """
+    assert inspect.ismethod(func) or inspect.isfunction(func)
+    regargs, varargs, varkwargs, defaults = inspect.getargspec(func)
+    argnames = list(regargs)
+    if varargs:
+        argnames.append(varargs)
+    if varkwargs:
+        argnames.append(varkwargs)
+    signature = inspect.formatargspec(regargs, varargs, varkwargs, defaults,
+                                      formatvalue=lambda value: "")[1:-1]
+    return dict(name=func.__name__, argnames=argnames, signature=signature,
+                defaults = func.func_defaults, doc=func.__doc__,
+                module=func.__module__, dict=func.__dict__,
+                globals=func.func_globals, closure=func.func_closure)
+
+@deprecated
+def update_wrapper(wrapper, model, infodict=None):
+    "A replacement for functools.update_wrapper"
+    infodict = infodict or getinfo(model)
+    wrapper.__name__ = infodict['name']
+    wrapper.__doc__ = infodict['doc']
+    wrapper.__module__ = infodict['module']
+    wrapper.__dict__.update(infodict['dict'])
+    wrapper.func_defaults = infodict['defaults']
+    wrapper.undecorated = model
+    return wrapper
+
+@deprecated
+def new_wrapper(wrapper, model):
+    """
+    An improvement over functools.update_wrapper. The wrapper is a generic
+    callable object. It works by generating a copy of the wrapper with the 
+    right signature and by updating the copy, not the original.
+    Moreovoer, 'model' can be a dictionary with keys 'name', 'doc', 'module',
+    'dict', 'defaults'.
+    """
+    if isinstance(model, dict):
+        infodict = model
+    else: # assume model is a function
+        infodict = getinfo(model)
+    assert not '_wrapper_' in infodict["argnames"], (
+        '"_wrapper_" is a reserved argument name!')
+    src = "lambda %(signature)s: _wrapper_(%(signature)s)" % infodict
+    funcopy = eval(src, dict(_wrapper_=wrapper))
+    return update_wrapper(funcopy, model, infodict)
diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py
index a51bfeb..f723b4b 100644
--- a/lib/matplotlib/pyplot.py
+++ b/lib/matplotlib/pyplot.py
@@ -1,3 +1,5 @@
+import decorator
+import inspect
 import sys
 
 import matplotlib
@@ -1588,1215 +1590,154 @@ def plotfile(fname, cols=(0,), plotfuncs=None,
     draw_if_interactive()
 
 
-## Plotting part 2: autogenerated wrappers for axes methods ##
+## Plotting part 2: wrappers for axes methods ##
 
+# Part 2a: plot commands
 
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def acorr(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().acorr(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.acorr.__doc__ is not None:
-    acorr.__doc__ = dedent(Axes.acorr.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def arrow(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().arrow(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.arrow.__doc__ is not None:
-    arrow.__doc__ = dedent(Axes.arrow.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def axhline(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().axhline(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.axhline.__doc__ is not None:
-    axhline.__doc__ = dedent(Axes.axhline.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def axhspan(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().axhspan(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.axhspan.__doc__ is not None:
-    axhspan.__doc__ = dedent(Axes.axhspan.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def axvline(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().axvline(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.axvline.__doc__ is not None:
-    axvline.__doc__ = dedent(Axes.axvline.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def axvspan(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().axvspan(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.axvspan.__doc__ is not None:
-    axvspan.__doc__ = dedent(Axes.axvspan.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def bar(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().bar(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.bar.__doc__ is not None:
-    bar.__doc__ = dedent(Axes.bar.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def barh(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().barh(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.barh.__doc__ is not None:
-    barh.__doc__ = dedent(Axes.barh.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def broken_barh(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().broken_barh(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.broken_barh.__doc__ is not None:
-    broken_barh.__doc__ = dedent(Axes.broken_barh.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def boxplot(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().boxplot(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.boxplot.__doc__ is not None:
-    boxplot.__doc__ = dedent(Axes.boxplot.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def cohere(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().cohere(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.cohere.__doc__ is not None:
-    cohere.__doc__ = dedent(Axes.cohere.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def clabel(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().clabel(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.clabel.__doc__ is not None:
-    clabel.__doc__ = dedent(Axes.clabel.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def contour(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().contour(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    if ret._A is not None: gci._current = ret
-    hold(b)
-    return ret
-if Axes.contour.__doc__ is not None:
-    contour.__doc__ = dedent(Axes.contour.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def contourf(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().contourf(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    if ret._A is not None: gci._current = ret
-    hold(b)
-    return ret
-if Axes.contourf.__doc__ is not None:
-    contourf.__doc__ = dedent(Axes.contourf.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def csd(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().csd(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.csd.__doc__ is not None:
-    csd.__doc__ = dedent(Axes.csd.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def errorbar(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().errorbar(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.errorbar.__doc__ is not None:
-    errorbar.__doc__ = dedent(Axes.errorbar.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def fill(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().fill(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.fill.__doc__ is not None:
-    fill.__doc__ = dedent(Axes.fill.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def fill_between(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().fill_between(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.fill_between.__doc__ is not None:
-    fill_between.__doc__ = dedent(Axes.fill_between.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def fill_betweenx(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().fill_betweenx(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.fill_betweenx.__doc__ is not None:
-    fill_betweenx.__doc__ = dedent(Axes.fill_betweenx.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def hexbin(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().hexbin(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    gci._current = ret
-    hold(b)
-    return ret
-if Axes.hexbin.__doc__ is not None:
-    hexbin.__doc__ = dedent(Axes.hexbin.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def hist(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().hist(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.hist.__doc__ is not None:
-    hist.__doc__ = dedent(Axes.hist.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def hlines(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().hlines(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.hlines.__doc__ is not None:
-    hlines.__doc__ = dedent(Axes.hlines.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def imshow(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().imshow(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    gci._current = ret
-    hold(b)
-    return ret
-if Axes.imshow.__doc__ is not None:
-    imshow.__doc__ = dedent(Axes.imshow.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def loglog(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().loglog(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.loglog.__doc__ is not None:
-    loglog.__doc__ = dedent(Axes.loglog.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def pcolor(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().pcolor(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    gci._current = ret
-    hold(b)
-    return ret
-if Axes.pcolor.__doc__ is not None:
-    pcolor.__doc__ = dedent(Axes.pcolor.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def pcolormesh(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().pcolormesh(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    gci._current = ret
-    hold(b)
-    return ret
-if Axes.pcolormesh.__doc__ is not None:
-    pcolormesh.__doc__ = dedent(Axes.pcolormesh.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def pie(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().pie(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.pie.__doc__ is not None:
-    pie.__doc__ = dedent(Axes.pie.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def plot(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().plot(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.plot.__doc__ is not None:
-    plot.__doc__ = dedent(Axes.plot.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def plot_date(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().plot_date(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.plot_date.__doc__ is not None:
-    plot_date.__doc__ = dedent(Axes.plot_date.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def psd(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().psd(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.psd.__doc__ is not None:
-    psd.__doc__ = dedent(Axes.psd.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def quiver(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().quiver(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    gci._current = ret
-    hold(b)
-    return ret
-if Axes.quiver.__doc__ is not None:
-    quiver.__doc__ = dedent(Axes.quiver.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def quiverkey(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().quiverkey(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.quiverkey.__doc__ is not None:
-    quiverkey.__doc__ = dedent(Axes.quiverkey.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
+def _wrapper_plotcmd(cmd, hold_in_args):
+    """
+    A wrapper generator for plot commands. The argument *cmd* is used
+    to look up the gci-updating method, if any, to be inserted into
+    the wrapper. If *hold_in_args* is true, *hold* is the last
+    argument in *args; otherwise it is a named argument in **kwargs.
+    """
+    mappable = _cmappable.get(cmd, lambda _:None)
 
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def scatter(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().scatter(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
+    def _wrapper_(f, *args, **kwargs):
+        b = ishold()
+        if hold_in_args:
+            args, h = args[:-1], args[-1]
+        else:
+            h = kwargs.pop('hold', None)
+        if h is not None:
+            hold(h)
+        try:
+            ret = f(gca(), *args, **kwargs)
+            draw_if_interactive()
+        finally:
+            hold(b)
+        mappable(ret)
+        return ret
+
+    return _wrapper_
+
+def _mappable(ret):
     gci._current = ret
-    hold(b)
-    return ret
-if Axes.scatter.__doc__ is not None:
-    scatter.__doc__ = dedent(Axes.scatter.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def semilogx(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().semilogx(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.semilogx.__doc__ is not None:
-    semilogx.__doc__ = dedent(Axes.semilogx.__doc__) + """
 
-Additional kwargs: hold = [True|False] overrides default hold state"""
+def _mappable_contour(ret):
+    if ret._A is not None:
+        gci._current = ret
 
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def semilogy(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().semilogy(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.semilogy.__doc__ is not None:
-    semilogy.__doc__ = dedent(Axes.semilogy.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def specgram(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().specgram(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
+def _mappable_specgram(ret):
     gci._current = ret[-1]
-    hold(b)
-    return ret
-if Axes.specgram.__doc__ is not None:
-    specgram.__doc__ = dedent(Axes.specgram.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def spy(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().spy(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-    gci._current = ret
-    hold(b)
-    return ret
-if Axes.spy.__doc__ is not None:
-    spy.__doc__ = dedent(Axes.spy.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def stem(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().stem(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.stem.__doc__ is not None:
-    stem.__doc__ = dedent(Axes.stem.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def step(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().step(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.step.__doc__ is not None:
-    step.__doc__ = dedent(Axes.step.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def vlines(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().vlines(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.vlines.__doc__ is not None:
-    vlines.__doc__ = dedent(Axes.vlines.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def xcorr(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().xcorr(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.xcorr.__doc__ is not None:
-    xcorr.__doc__ = dedent(Axes.xcorr.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def barbs(*args, **kwargs):
-    # allow callers to override the hold state by passing hold=True|False
-    b = ishold()
-    h = kwargs.pop('hold', None)
-    if h is not None:
-        hold(h)
-    try:
-        ret =  gca().barbs(*args, **kwargs)
-        draw_if_interactive()
-    except:
-        hold(b)
-        raise
-
-    hold(b)
-    return ret
-if Axes.barbs.__doc__ is not None:
-    barbs.__doc__ = dedent(Axes.barbs.__doc__) + """
-
-Additional kwargs: hold = [True|False] overrides default hold state"""
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def cla(*args, **kwargs):
-
-    ret =  gca().cla(*args, **kwargs)
-    draw_if_interactive()
-    return ret
-if Axes.cla.__doc__ is not None:
-    cla.__doc__ = dedent(Axes.cla.__doc__)
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def grid(*args, **kwargs):
-
-    ret =  gca().grid(*args, **kwargs)
-    draw_if_interactive()
-    return ret
-if Axes.grid.__doc__ is not None:
-    grid.__doc__ = dedent(Axes.grid.__doc__)
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def legend(*args, **kwargs):
-
-    ret =  gca().legend(*args, **kwargs)
-    draw_if_interactive()
-    return ret
-if Axes.legend.__doc__ is not None:
-    legend.__doc__ = dedent(Axes.legend.__doc__)
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def table(*args, **kwargs):
-
-    ret =  gca().table(*args, **kwargs)
-    draw_if_interactive()
-    return ret
-if Axes.table.__doc__ is not None:
-    table.__doc__ = dedent(Axes.table.__doc__)
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def text(*args, **kwargs):
-
-    ret =  gca().text(*args, **kwargs)
-    draw_if_interactive()
-    return ret
-if Axes.text.__doc__ is not None:
-    text.__doc__ = dedent(Axes.text.__doc__)
 
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def annotate(*args, **kwargs):
-
-    ret =  gca().annotate(*args, **kwargs)
+_cmappable = {
+    'contour'    : _mappable_contour,
+    'contourf'   : _mappable_contour,
+    'hexbin'     : _mappable,
+    'scatter'    : _mappable,
+    'pcolor'     : _mappable,
+    'pcolormesh' : _mappable,
+    'imshow'     : _mappable,
+    'spy'        : _mappable,
+    'quiver'     : _mappable,
+    'specgram'   : _mappable_specgram
+}
+
+def _wrap_plotcmd(cmd):
+    """
+    Wrap the Axes method named *cmd* for inclusion as a function in pyplot.
+    """
+    func = getattr(Axes, cmd).im_func # the function to be wrapped
+
+    # Come up with the right signature
+    args, varargs, varkw, defaults = inspect.getargspec(func)
+    args.pop(0)                 # remove "self"
+    if not varargs:             # add hold=None if possible
+        args.append('hold')
+        if defaults is None:
+            defaults = (None,)
+        else:
+            defaults = defaults + (None,)
+    signature = inspect.formatargspec(args, varargs, varkw, defaults,
+                                      formatvalue=lambda _:"")[1:-1]
+
+    # Wrap the function in a wrapper having the right signature
+    maker = decorator.FunctionMaker(func, signature=signature, defaults=defaults,
+                                    module='matplotlib.pyplot')
+    if maker.doc is not None:
+        maker.doc = dedent(maker.doc) + '''
+
+Additional kwargs: hold = [True|False] overrides default hold state
+'''
+    wrapper = _wrapper_plotcmd(cmd, not varargs)
+    return maker.make(
+        "def %(name)s(%(signature)s): return _call_(_func_, %(signature)s)",
+        dict(_func_=func, _call_=wrapper), undecorated=func)
+
+g = globals()                   # for assigning to g[cmd]
+for cmd in ('acorr', 'arrow', 'axhline', 'axhspan', 'axvline', 'axvspan',
+            'bar',  'barbs', 'barh', 'broken_barh', 'boxplot',
+            'cohere', 'clabel', 'contour', 'contourf', 'csd',
+            'errorbar', 'fill', 'fill_between', 'fill_betweenx',
+            'hexbin', 'hist', 'hlines', 'imshow', 'loglog',
+            'pcolor', 'pcolormesh', 'pie', 'plot', 'plot_date', 'psd',
+            'quiver', 'quiverkey',
+            'scatter', 'semilogx', 'semilogy', 'specgram', 'spy', 'stem', 'step',
+            'vlines', 'xcorr'):
+    g[cmd] = _wrap_plotcmd(cmd)
+
+# Part 2b: misc commands
+
+def _wrapper_misccmd(f, *args, **kwargs):
+    """
+    Wrapper for miscellaneous (non-plotting) commands.
+    """
+    ret = f(gca(), *args, **kwargs)
     draw_if_interactive()
     return ret
-if Axes.annotate.__doc__ is not None:
-    annotate.__doc__ = dedent(Axes.annotate.__doc__)
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def autumn():
-    '''
-    set the default colormap to autumn and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='autumn')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.autumn)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def bone():
-    '''
-    set the default colormap to bone and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='bone')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.bone)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def cool():
-    '''
-    set the default colormap to cool and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='cool')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.cool)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def copper():
-    '''
-    set the default colormap to copper and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='copper')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.copper)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def flag():
-    '''
-    set the default colormap to flag and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='flag')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.flag)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def gray():
-    '''
-    set the default colormap to gray and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='gray')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.gray)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def hot():
-    '''
-    set the default colormap to hot and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='hot')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.hot)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def hsv():
-    '''
-    set the default colormap to hsv and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='hsv')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.hsv)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def jet():
-    '''
-    set the default colormap to jet and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='jet')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.jet)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def pink():
-    '''
-    set the default colormap to pink and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='pink')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.pink)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def prism():
-    '''
-    set the default colormap to prism and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='prism')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.prism)
-    draw_if_interactive()
 
+def _wrap_misccmd(cmd):
+    """
+    Wrap the non-plotting Axes method named *cmd* for inclusion in pyplot.
+    """
+    func = getattr(Axes, cmd).im_func
+    args, varargs, varkw, defaults = inspect.getargspec(func)
+    args.pop(0)
+    signature = inspect.formatargspec(args, varargs, varkw, defaults,
+                                      formatvalue=lambda _:"")[1:-1]
+    maker = decorator.FunctionMaker(func, signature=signature, defaults=defaults,
+                                    module='matplotlib.pyplot')
+    return maker.make(
+        "def %(name)s(%(signature)s): return _call_(_func_, %(signature)s)",
+        dict(_func_=func, _call_=_wrapper_misccmd), undecorated=func)
 
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def spring():
-    '''
-    set the default colormap to spring and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='spring')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.spring)
-    draw_if_interactive()
-
-
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def summer():
-    '''
-    set the default colormap to summer and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='summer')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.summer)
-    draw_if_interactive()
-
+for cmd in ('annotate', 'cla', 'grid', 'legend', 'table', 'text'):
+    g[cmd] = _wrap_misccmd(cmd)
 
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def winter():
-    '''
-    set the default colormap to winter and apply to current image if any.
-    See help(colormaps) for more information
-    '''
-    rc('image', cmap='winter')
-    im = gci()
+# Part 2c: colormap commands
 
-    if im is not None:
-        im.set_cmap(cm.winter)
-    draw_if_interactive()
+def _wrap_cmap(name):
+    """
+    Make a function that sets the colormap to *name*.
+    """
+    def set_cmap():
+        rc('image', cmap=name)
+        im = gci()
 
+        if im is not None:
+            im.set_cmap(getattr(cm, name))
+        draw_if_interactive()
 
-# This function was autogenerated by boilerplate.py.  Do not edit as
-# changes will be lost
-def spectral():
-    '''
-    set the default colormap to spectral and apply to current image if any.
+    set_cmap.__doc__ = '''
+    Set the default colormap to %s and apply to current image if any.
     See help(colormaps) for more information
-    '''
-    rc('image', cmap='spectral')
-    im = gci()
-
-    if im is not None:
-        im.set_cmap(cm.spectral)
-    draw_if_interactive()
+    ''' % name
+    set_cmap.__name__ = name
+    return set_cmap
 
+for cmd in ('autumn', 'bone', 'cool', 'copper', 'flag', 'gray' , 'hot', 'hsv',
+            'jet' , 'pink', 'prism', 'spectral', 'spring', 'summer', 'winter'):
+    g[cmd] = _wrap_cmap(cmd)
 
+del g, cmd
diff --git a/license/LICENSE_DECORATOR_PY b/license/LICENSE_DECORATOR_PY
new file mode 100644
index 0000000..14daeb9
--- /dev/null
+++ b/license/LICENSE_DECORATOR_PY
@@ -0,0 +1,26 @@
+##########################     LICENCE     ###############################
+      
+##   Redistributions of source code must retain the above copyright 
+##   notice, this list of conditions and the following disclaimer.
+##   Redistributions in bytecode form must reproduce the above copyright
+##   notice, this list of conditions and the following disclaimer in
+##   the documentation and/or other materials provided with the
+##   distribution. 
+
+##   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+##   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+##   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+##   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+##   HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+##   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+##   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+##   OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+##   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+##   TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+##   USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+##   DAMAGE.
+
+"""
+Decorator module, see http://pypi.python.org/pypi/decorator
+for the documentation.
+"""
