Hi, folks.  OK, I'm trying to set the alpha channel, pixel by pixel, using 
figimage w/ the data being of the "luminance" type (i.e., an MxN array).  The 
Users Guide indicates that figimage takes an alpha= keyword argument, and it 
doesn't crash when I pass an array for this value, but subsequently when I try 
to draw it using fig.draw(canvas.get_renderer()), I get:

>>> fig.draw(canvas.get_renderer())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python25\lib\site-packages\matplotlib\figure.py", line 607, in draw
    im.draw(renderer)
  File "C:\python25\lib\site-packages\matplotlib\image.py", line 597, in draw
    im = self.make_image()
  File "C:\python25\lib\site-packages\matplotlib\image.py", line 583, in make_im
age
    x = self.to_rgba(self._A, self._alpha)
  File "C:\python25\lib\site-packages\matplotlib\cm.py", line 76, in to_rgba
    x = self.cmap(x, alpha=alpha, bytes=bytes)
  File "C:\python25\lib\site-packages\matplotlib\colors.py", line 423, in __call
__
    alpha = min(alpha, 1.0) # alpha must be between 0 and 1
ValueError: The truth value of an array with more than one element is ambiguous.
 Use a.any() or a.all()

which to me "smells" as if the array-valued alpha is the problem.  

Clearly (?) I can do what I'm after if I use MxNx4 data, but is that the only 
way to have a varying alpha?

Thanks!

DG





      

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to