Revision: 8930
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8930&view=rev
Author:   weathergod
Date:     2011-01-21 20:38:54 +0000 (Fri, 21 Jan 2011)

Log Message:
-----------
Fixing polygon shading in mplot3d and simultaneously allowing users to specify 
alpha values for 3d polygons.
(Shading calculation was applied to the rgba array instead of just rgb)

Modified Paths:
--------------
    trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py

Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2011-01-18 22:12:52 UTC 
(rev 8929)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2011-01-21 20:38:54 UTC 
(rev 8930)
@@ -818,13 +818,13 @@
 
         if len(shade[mask]) > 0:
             norm = Normalize(min(shade[mask]), max(shade[mask]))
-            if art3d.iscolor(color):
-                color = color.copy()
-                color[3] = 1
-                colors = np.outer(0.5 + norm(shade) * 0.5, color)
-            else:
-                colors = colorConverter.to_rgba_array(color) * \
-                            (0.5 + 0.5 * norm(shade)[:, np.newaxis])
+            color = colorConverter.to_rgba_array(color)
+            # shape of color should be (M, 4) (where M is number of faces)
+            # shape of shade should be (M,)
+            # colors should have final shape of (M, 4)
+            alpha = color[:, 3]
+            colors = (0.5 + norm(shade)[:, np.newaxis] * 0.5) * color
+            colors[:, 3] = alpha
         else:
             colors = color.copy()
 


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

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Matplotlib-checkins mailing list
Matplotlib-checkins@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to