Hi,
The following script produces a single point that is green and translucent:
import matplotlib.pyplot as mpl
fig = mpl.figure()
ax = fig.add_subplot(111)
ax.scatter([0.],[0.],c=1.,alpha=0.2,vmin=0,vmax=2.0,cmap=mpl.cm.jet)
fig.canvas.draw()
and the following script produces a single point that is red and definitely
not translucent, because the color defined by c= is above vmax.
import matplotlib.pyplot as mpl
fig = mpl.figure()
ax = fig.add_subplot(111)
ax.scatter([0.],[0.],c=1.,alpha=0.2,vmin=0,vmax=0.5,cmap=mpl.cm.jet)
fig.canvas.draw()
Whether this is intentional or not, I'm not sure, but I would have expected
that alpha overrides the fact the color is out of bounds. In any case, this
pops up sometimes if I am plotting multiple points with different colors
given by an array, because vmax and vmin are automatically computed, and
because of numerical accuracy sometimes the 'brightest' point loses it's
alpha. The following example illustrates this:
import matplotlib.pyplot as mpl
import numpy as np
np.random.seed(-12421412)
x = np.random.random(10000)
y = np.random.random(10000)
c = np.random.random(10000)
fig = mpl.figure()
ax = fig.add_subplot(111)
ax.scatter(x,y,c=c,alpha=0.01,cmap=mpl.cm.jet)
fig.canvas.draw()
Is this a bug in the way the colormap/alpha is handled?
Thanks,
Thomas
···
–
View this message in context: http://www.nabble.com/bug-in-scatter--tp24811933p24811933.html
Sent from the matplotlib - users mailing list archive at Nabble.com.