Gregor Thalhammer | 6 Oct 17:21

scatter and alpha settings

Dear developers,

in matplotlib 0.98.3 I discoverd that in scatter individual alpha 
settings (by giving a list of rgba values) are ignered. Here an example 
that show this behaviour: All points show the same alpha value as given 
by the alpha keyword argument. (Omitting it equals to the setting alpha=1).

from pylab import *

x = [1,2,3]
y = [1,2,3]

c = [[1,0,0, 0.0],
     [1,0,0, 0.5],
     [1,0,0, 1.0]]

gca()
cla()
scatter(x,y, c=c, s = 200, alpha = 0.5)
draw()
show()

I had a look at the sources. In axes.py/scatter I simply removed the line

collection.set_alpha(alpha)

The recent svn version also contains this line.
With this change it worked as expected, also e.g. for the case of a 
single color for all points,

(Continue reading)

Eric Firing | 9 Oct 20:15
Favicon

Re: scatter and alpha settings

Gregor Thalhammer wrote:
> Dear developers,
> 
> in matplotlib 0.98.3 I discoverd that in scatter individual alpha 
> settings (by giving a list of rgba values) are ignered. Here an example 
> that show this behaviour: All points show the same alpha value as given 
> by the alpha keyword argument. (Omitting it equals to the setting alpha=1).
> 
> 
> from pylab import *
> 
> x = [1,2,3]
> y = [1,2,3]
> 
> c = [[1,0,0, 0.0],
>      [1,0,0, 0.5],
>      [1,0,0, 1.0]]
> 
> gca()
> cla()
> scatter(x,y, c=c, s = 200, alpha = 0.5)
> draw()
> show()
> 
> 
> I had a look at the sources. In axes.py/scatter I simply removed the line
> 
> collection.set_alpha(alpha)

You are correct that there is a bug, in that the alpha in rgba arrays is 
(Continue reading)


Gmane