Revision: 3991
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3991&view=rev
Author:   efiring
Date:     2007-10-23 14:25:24 -0700 (Tue, 23 Oct 2007)

Log Message:
-----------
Bugfix: save colorbar axis label so it won't get lost

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

Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py 2007-10-23 19:48:14 UTC (rev 
3990)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py 2007-10-23 21:25:24 UTC (rev 
3991)
@@ -155,6 +155,7 @@
         self.filled = filled
         self.solids = None
         self.lines = None
+        self.set_label('')
         if cbook.iterable(ticks):
             self.locator = ticker.FixedLocator(ticks, nbins=len(ticks))
         else:
@@ -183,6 +184,7 @@
         self._config_axes(X, Y)
         if self.filled:
             self._add_solids(X, Y, C)
+        self._set_label()
 
     def _config_axes(self, X, Y):
         '''
@@ -220,12 +222,18 @@
             ax.set_xticklabels(ticklabels)
             ax.xaxis.get_major_formatter().set_offset_string(offset_string)
 
-    def set_label(self, label, **kw):
+    def _set_label(self):
         if self.orientation == 'vertical':
-            self.ax.set_ylabel(label, **kw)
+            self.ax.set_ylabel(self._label, **self._labelkw)
         else:
-            self.ax.set_xlabel(label, **kw)
+            self.ax.set_xlabel(self._label, **self._labelkw)
 
+    def set_label(self, label, **kw):
+        self._label = label
+        self._labelkw = kw
+        self._set_label()
+
+
     def _outline(self, X, Y):
         '''
         Return x, y arrays of colorbar bounding polygon,
@@ -556,6 +564,10 @@
         is changed.
         '''
         cm.ScalarMappable.notify(self, mappable)
+        # 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()
         self.draw_all()
         #if self.vmin != self.norm.vmin or self.vmax != self.norm.vmax:


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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to