Revision: 8286
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8286&view=rev
Author:   efiring
Date:     2010-04-28 20:49:48 +0000 (Wed, 28 Apr 2010)

Log Message:
-----------
colorbar: close 2986719 with small fixups and docstring expansion

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/colorbar.py

Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py 2010-04-28 19:50:39 UTC (rev 
8285)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py 2010-04-28 20:49:48 UTC (rev 
8286)
@@ -160,8 +160,9 @@
     Draw a colorbar in an existing axes.
 
     This is a base class for the :class:`Colorbar` class, which is the
-    basis for the :func:`~matplotlib.pyplot.colorbar` method and pylab
-    function.
+    basis for the :func:`~matplotlib.pyplot.colorbar` function and the
+    :meth:`~matplotlib.figure.Figure.colorbar` method, which are the
+    usual ways of creating a colorbar.
 
     It is also useful by itself for showing a colormap.  If the *cmap*
     kwarg is given but *boundaries* and *values* are left as None,
@@ -411,6 +412,9 @@
         if self.solids is not None:
             self.solids.remove()
         self.solids = col
+        if self.dividers is not None:
+            self.dividers.remove()
+            self.dividers = None
         if self.drawedges:
             self.dividers = collections.LineCollection(self._edges(X,Y),
                               colors=(mpl.rcParams['axes.edgecolor'],),
@@ -684,6 +688,17 @@
         self.alpha = alpha
 
 class Colorbar(ColorbarBase):
+    """
+    This class connects a :class:`ColorbarBase` to a
+    :class:`~matplotlib.cm.ScalarMappable` such as a
+    :class:`~matplotlib.image.AxesImage` generated via
+    :meth:`~matplotlib.axes.Axes.imshow`.
+
+    It is not intended to be instantiated directly; instead,
+    use :meth:`~matplotlib.figure.Figure.colorbar` or
+    :func:`~matplotlib.pyplot.colorbar` to make your colorbar.
+
+    """
     def __init__(self, ax, mappable, **kw):
         mappable.autoscale_None() # Ensure mappable.norm.vmin, vmax
                              # are set when colorbar is called,
@@ -747,20 +762,28 @@
 
     def update_bruteforce(self, mappable):
         '''
-        Manually change any contour line colors.  This is called
-        when the image or contour plot to which this colorbar belongs
-        is changed.
+        Destroy and rebuild the colorbar.  This is
+        intended to become obsolete, and will probably be
+        deprecated and then removed.  It is not called when
+        the pyplot.colorbar function or the Figure.colorbar
+        method are used to create the colorbar.
+
         '''
         # We are using an ugly brute-force method: clearing and
         # redrawing the whole thing.  The problem is that if any
         # properties have been changed by methods other than the
         # colorbar methods, those changes will be lost.
         self.ax.cla()
+        # clearing the axes will delete outline, patch, solids, and lines:
+        self.outline = None
+        self.patch = None
+        self.solids = None
+        self.lines = None
+        self.set_alpha(mappable.get_alpha())
+        self.cmap = mappable.cmap
+        self.norm = mappable.norm
         self.config_axis()
         self.draw_all()
-        #if self.vmin != self.norm.vmin or self.vmax != self.norm.vmax:
-        #    self.ax.cla()
-        #    self.draw_all()
         if isinstance(self.mappable, contour.ContourSet):
             CS = self.mappable
             if not CS.filled:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to