Revision: 4302
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4302&view=rev
Author:   mdboom
Date:     2007-11-15 07:13:38 -0800 (Thu, 15 Nov 2007)

Log Message:
-----------
Fix Subplot backward-incompatibility.

Modified Paths:
--------------
    branches/transforms/lib/matplotlib/axes.py

Modified: branches/transforms/lib/matplotlib/axes.py
===================================================================
--- branches/transforms/lib/matplotlib/axes.py  2007-11-15 14:59:53 UTC (rev 
4301)
+++ branches/transforms/lib/matplotlib/axes.py  2007-11-15 15:13:38 UTC (rev 
4302)
@@ -5465,6 +5465,7 @@
         for label in self.get_yticklabels():
             label.set_visible(firstcol)
 
+_subplot_classes = {}            
 def subplot_class_factory(axes_class=None):
     # This makes a new class that inherits from SubclassBase and the
     # given axes_class (which is assumed to be a subclass of Axes).
@@ -5472,11 +5473,21 @@
     # This is perhaps a little bit roundabout to make a new class on
     # the fly like this, but it means that a new Subplot class does
     # not have to be created for every type of Axes.
-    new_class = new.classobj("%sSubplot" % (axes_class.__name__),
-                             (SubplotBase, axes_class),
-                             {'_axes_class': axes_class})
+    if axes_class is None:
+        axes_class = Axes
+    
+    new_class = _subplot_classes.get(axes_class)
+    if new_class is None:
+        new_class = new.classobj("%sSubplot" % (axes_class.__name__),
+                                 (SubplotBase, axes_class),
+                                 {'_axes_class': axes_class})
+        _subplot_classes[axes_class] = new_class
+        
     return new_class
-        
+
+# This is provided for backward compatibility
+Subplot = subplot_class_factory()
+
 martist.kwdocd['Axes'] = martist.kwdocd['Subplot'] = martist.kwdoc(Axes)
 
 """


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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to