Revision: 5051
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5051&view=rev
Author:   efiring
Date:     2008-04-19 17:57:40 -0700 (Sat, 19 Apr 2008)

Log Message:
-----------
Make alpha work for contour and contourf (thanks to Stephane Raynaud)

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

Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py  2008-04-19 14:22:11 UTC (rev 
5050)
+++ trunk/matplotlib/lib/matplotlib/contour.py  2008-04-20 00:57:40 UTC (rev 
5051)
@@ -325,7 +325,8 @@
         levels = self.label_levels
         fslist = self.fslist
         trans = self.ax.transData
-        _colors = self.label_mappable.to_rgba(self.label_cvalues)
+        _colors = self.label_mappable.to_rgba(self.label_cvalues,
+                                                        alpha=self.alpha)
         fmt = self.fmt
         for icon, lev, color, cvalue, fsize in zip(self.label_indices,
                                           self.label_levels,
@@ -456,7 +457,8 @@
                         nchunk = self.nchunk)
                 col = collections.PolyCollection(nlist,
                                      antialiaseds = (self.antialiased,),
-                                     edgecolors= 'None')
+                                     edgecolors= 'none',
+                                     alpha=self.alpha)
                 self.ax.add_collection(col)
                 self.collections.append(col)
 
@@ -469,7 +471,8 @@
                 nlist = C.trace(level, points = 0)
                 col = collections.LineCollection(nlist,
                                      linewidths = width,
-                                     linestyle = lstyle)
+                                     linestyle = lstyle,
+                                     alpha=self.alpha)
 
                 if level < 0.0 and self.monochrome:
                     ls = mpl.rcParams['contour.negative_linestyle']
@@ -491,8 +494,10 @@
                                 self.to_rgba(self.cvalues, alpha=self.alpha)]
         self.tcolors = tcolors
         for color, collection in zip(tcolors, self.collections):
+            collection.set_alpha(self.alpha)
             collection.set_color(color)
         for label, cv in zip(self.cl, self.cl_cvalues):
+            label.set_alpha(self.alpha)
             label.set_color(self.label_mappable.to_rgba(cv))
         # add label colors
         cm.ScalarMappable.changed(self)
@@ -718,11 +723,11 @@
         return tlinestyles
 
     def get_alpha(self):
-        '''For compatibility with artists, return self.alpha'''
+        '''returns alpha to be applied to all ContourSet artists'''
         return self.alpha
 
     def set_alpha(self, alpha):
-        '''For compatibility with artists, set self.alpha'''
+        '''sets alpha for all ContourSet artists'''
         self.alpha = alpha
         self.changed()
 


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 the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to