Revision: 5554
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5554&view=rev
Author:   mdboom
Date:     2008-06-16 05:14:22 -0700 (Mon, 16 Jun 2008)

Log Message:
-----------
Fix bug specifying alpha in a color array. (Thanks, M?\195?\161ty?\195?\161s 
J?\195?\161nos)

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

Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py   2008-06-16 12:04:29 UTC (rev 
5553)
+++ trunk/matplotlib/lib/matplotlib/colors.py   2008-06-16 12:14:22 UTC (rev 
5554)
@@ -291,11 +291,15 @@
         """
         try:
             if not cbook.is_string_like(arg) and cbook.iterable(arg):
-                if len(arg) == 4 and alpha is None:
+                if len(arg) == 4:
                     if [x for x in arg if (float(x) < 0) or  (x > 1)]:
                         # This will raise TypeError if x is not a number.
                         raise ValueError('number in rbga sequence outside 0-1 
range')
-                    return tuple(arg)
+                    if alpha is None:
+                        return tuple(arg)
+                    if alpha < 0.0 or alpha > 1.0:
+                        raise ValueError("alpha must be in range 0-1")
+                    return arg[0], arg[1], arg[2], arg[3] * alpha
                 r,g,b = arg[:3]
                 if [x for x in (r,g,b) if (float(x) < 0) or  (x > 1)]:
                     raise ValueError('number in rbg sequence outside 0-1 
range')


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to