Thu Nov 11 18:40:47 CET 2004  Norbert@...160...
  * cleaned up kwargs handling in axes.py

diff -rN -u matplotlib-old/lib/matplotlib/axes.py matplotlib-new/lib/matplotlib/axes.py
--- matplotlib-old/lib/matplotlib/axes.py	2004-11-17 11:13:23.000000000 +0100
+++ matplotlib-new/lib/matplotlib/axes.py	2004-11-11 18:23:35.000000000 +0100
@@ -138,7 +138,7 @@
         self.count = 0
         
     def __call__(self, *args, **kwargs):
-        
+
         ret =  self._grab_next_args(*args, **kwargs)
         return ret
 
@@ -146,17 +146,19 @@
         assert self.command == 'plot', 'set_lineprops only works with "plot"'
         for key, val in kwargs.items():
             funcName = "set_%s"%key
-            if hasattr(line,funcName):
-                func = getattr(line,funcName)
-                func(val)
+            if not hasattr(line,funcName):
+                raise TypeError, 'There is no line property "%s"'%key
+            func = getattr(line,funcName)
+            func(val)
         
     def set_patchprops(self, fill_poly, **kwargs):
         assert self.command == 'fill', 'set_patchprops only works with "fill"'
         for key, val in kwargs.items():
             funcName = "set_%s"%key
-            if hasattr(fill_poly,funcName):
-                func = getattr(fill_poly,funcName)
-                func(val)
+            if not hasattr(fill_poly,funcName):
+                raise TypeError, 'There is no patch property "%s"'%key
+            func = getattr(fill_poly,funcName)
+            func(val)
 
 
     def is_filled(self, marker):
@@ -296,8 +298,7 @@
 
     def __init__(self, fig, rect,
                  axisbg = None, # defaults to rc axes.facecolor
-                 frameon = True,
-                 **kwargs):
+                 frameon = True):
         Artist.__init__(self)
 
 
@@ -928,7 +929,7 @@
 
         return pxy, freqs
 
-    def draw(self, renderer, *args, **kwargs):
+    def draw(self, renderer):
         "Draw everything (plot lines, axes, labels)"
         
         renderer.open_group('axes')
@@ -1495,11 +1496,11 @@
   * subsy: the location of the minor yticks; None defaults to range(2,basey)    
         """
         if not self._hold: self.cla()
-        dx = {'basex': kwargs.get('basex', 10),
-              'subsx': kwargs.get('subsx', None),
+        dx = {'basex': kwargs.pop('basex', 10),
+              'subsx': kwargs.pop('subsx', None),
               }
-        dy = {'basey': kwargs.get('basey', 10),
-              'subsy': kwargs.get('subsy', None),
+        dy = {'basey': kwargs.pop('basey', 10),
+              'subsy': kwargs.pop('subsy', None),
               }
 
         self.set_xscale('log', **dx)
@@ -1585,12 +1586,14 @@
         """
         if not self._hold: self.cla()
 
-        alpha = kwargs.get('alpha', 1.0)
-        norm = kwargs.get('norm')
-        cmap = kwargs.get('cmap')        
-        vmin = kwargs.get('vmin')
-        vmax = kwargs.get('vmax')        
-        shading = kwargs.get('shading', 'faceted')
+        alpha = kwargs.pop('alpha', 1.0)
+        norm = kwargs.pop('norm')
+        cmap = kwargs.pop('cmap')        
+        vmin = kwargs.pop('vmin')
+        vmax = kwargs.pop('vmax')        
+        shading = kwargs.pop('shading', 'faceted')
+        if len(kwargs):
+            raise TypeError, 'Unknown argument "%s"'%kwargs.keys()[0]
 
         if len(args)==1:
             C = args[0]
@@ -1599,7 +1602,7 @@
         elif len(args)==3:
             X, Y, C = args
         else:
-            raise RuntimeError('Illegal arguments to pcolor; see help(pcolor)')
+            raise TypeError, 'Illegal arguments to pcolor; see help(pcolor)'
         
         Nx, Ny = X.shape
         patches = []
@@ -1703,7 +1706,12 @@
         """
 
         if not self._hold: self.cla()
-        shading = kwargs.get('shading', 'faceted')
+        shading = kwargs.pop('shading', 'faceted')
+        cmap = kwargs.pop('cmap', cm.get_cmap())
+        norm = kwargs.pop('norm', normalize())
+        alpha = kwargs.pop('alpha', 1.0)
+        if len(kwargs):
+            raise TypeError, 'Unknown argument "%s"'%kwargs.keys()[0]
 
         if len(args)==1:
             C = args[0]
@@ -1712,18 +1720,13 @@
         elif len(args)==3:
             X, Y, C = args
         else:
-            raise RuntimeError('Illegal arguments to pcolor; see help(pcolor)')
+            raise TypeError, 'Illegal arguments to pcolor; see help(pcolor)'
         
-
         Nx, Ny = X.shape
 
-        cmap = kwargs.get('cmap', cm.get_cmap())
-        norm = kwargs.get('norm', normalize())
         if isinstance(norm, normalize) and not norm.scaled():
             norm.autoscale(C)
  
-
-        alpha = kwargs.get('alpha', 1.0)
         nc = norm(C)
         RGBA = cmap(nc, alpha)
 
@@ -2212,8 +2215,8 @@
 
         """
 
-        d = {'basex': kwargs.get('basex', 10),
-             'subsx': kwargs.get('subsx', None),
+        d = {'basex': kwargs.pop('basex', 10),
+             'subsx': kwargs.pop('subsx', None),
              }
              
         self.set_xscale('log', **d)
@@ -2238,8 +2241,8 @@
       range(2,basey)
 
         """
-        d = {'basey': kwargs.get('basey', 10),
-             'subsy': kwargs.get('subsy', None),
+        d = {'basey': kwargs.pop('basey', 10),
+             'subsy': kwargs.pop('subsy', None),
              }
 
         self.set_yscale('log', **d)
@@ -2721,7 +2724,7 @@
       Subplot(211)    # 2 rows, 1 column, first (upper) plot
     """
     
-    def __init__(self, *args, **kwargs):
+    def __init__(self, *args):
         # Axes __init__ below
 
         if len(args)==1:
@@ -2791,7 +2794,7 @@
       Subplot(211)    # 2 rows, 1 column, first (upper) plot
     """
     def __init__(self, fig, *args, **kwargs):
-        SubplotBase.__init__(self, *args, **kwargs)        
+        SubplotBase.__init__(self, *args)        
         Axes.__init__(self, fig, [self.figLeft, self.figBottom, self.figW, self.figH], **kwargs)
 
 
@@ -3109,6 +3112,6 @@
       Subplot(211)    # 2 rows, 1 column, first (upper) plot
     """
     def __init__(self, fig, *args, **kwargs):
-        SubplotBase.__init__(self, *args, **kwargs)        
+        SubplotBase.__init__(self, *args)        
         PolarAxes.__init__(self, fig, [self.figLeft, self.figBottom, self.figW, self.figH], **kwargs)
 
