Revision: 7172
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7172&view=rev
Author:   astraw
Date:     2009-06-01 22:39:49 +0000 (Mon, 01 Jun 2009)

Log Message:
-----------
Add set_color() convenience method to Spine class

Modified Paths:
--------------
    trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py
    trunk/matplotlib/lib/matplotlib/spines.py

Modified: trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py    
2009-06-01 22:20:26 UTC (rev 7171)
+++ trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py    
2009-06-01 22:39:49 UTC (rev 7172)
@@ -12,7 +12,7 @@
     if loc in ['left','bottom']:
         spine.set_position(('outward',10)) # outward by 10 points
     elif loc in ['right','top']:
-        spine.set_edgecolor('none') # don't draw spine
+        spine.set_color('none') # don't draw spine
     else:
         raise ValueError('unknown spine location: %s'%loc)
 
@@ -34,9 +34,9 @@
 ax.set_title('centered spines')
 ax.plot(x,y)
 ax.spines['left'].set_position('center')
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position('center')
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -44,9 +44,9 @@
 ax.set_title('zeroed spines')
 ax.plot(x,y)
 ax.spines['left'].set_position('zero')
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position('zero')
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -54,9 +54,9 @@
 ax.set_title('spines at axes (0.6, 0.1)')
 ax.plot(x,y)
 ax.spines['left'].set_position(('axes',0.6))
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position(('axes',0.1))
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -64,9 +64,9 @@
 ax.set_title('spines at data (1,2)')
 ax.plot(x,y)
 ax.spines['left'].set_position(('data',1))
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position(('data',2))
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -77,7 +77,7 @@
         if loc in spines:
             spine.set_position(('outward',10)) # outward by 10 points
         else:
-            spine.set_edgecolor('none') # don't draw spine
+            spine.set_color('none') # don't draw spine
 
     # turn off ticks where there is no spine
     if 'left' in spines:

Modified: trunk/matplotlib/lib/matplotlib/spines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/spines.py   2009-06-01 22:20:26 UTC (rev 
7171)
+++ trunk/matplotlib/lib/matplotlib/spines.py   2009-06-01 22:39:49 UTC (rev 
7172)
@@ -303,3 +303,18 @@
         result = cls(axes,spine_type,path,**kwargs)
         result.set_patch_circle(center,radius)
         return result
+
+    def set_color(self, c):
+        """
+        Set the edgecolor.
+
+        ACCEPTS: matplotlib color arg or sequence of rgba tuples
+
+        .. seealso::
+
+            :meth:`set_facecolor`, :meth:`set_edgecolor`
+               For setting the edge or face color individually.
+        """
+        # The facecolor of a spine is always 'none' by default -- let
+        # the user change it manually if desired.
+        self.set_edgecolor(c)


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

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to