Hello,

According to http://matplotlib.sourceforge.net/api/ 
pyplot_api.html#matplotlib.pyplot.scatter , the keyword argument that  
takes an array to specify the colors of the individual markers is c.  
color is interpreted as a color to give to all markers at once.

The following works on my computer (matplotlib 0.99.0) :

import numpy as N
from matplotlib import pyplot as P

x = N.random.randn(100)
y = N.random.randn(100)
z = N.random.randn(100)**2

fig = P.figure()
ax = fig.add_subplot(1,1,1)

cmap = P.matplotlib.cm.jet
norm = P.matplotlib.colors.Normalize(vmin=0, vmax=1)

sc = ax.scatter(x,y,
                  c=z,
                  cmap=cmap,
                  norm=norm,
                  )



Le 10 déc. 09 à 14:44, Yannick Copin a écrit :

> Hi,
>
> according to the documentation, scatter should accept a 1D float  
> array for
> color kwarg. Therefore, I thought the following code would work  
> (and I think
> it worked at some point in the past; I'm currently using matplotlib  
> 0.99.0):
>
> import numpy as N
> from matplotlib import pyplot as P
>
> x = N.random.randn(100)
> y = N.random.randn(100)
> z = N.random.randn(100)**2
>
> fig = P.figure()
> ax = fig.add_subplot(1,1,1)
>
> cmap = P.matplotlib.cm.jet
> norm = P.matplotlib.colors.Normalize(vmin=0, vmax=1)
>
> sc = ax.scatter(x,y,
>                  color=z,
>                  cmap=cmap,
>                  norm=norm,
>                  )
>
> But this crashes with the following error:
>
> [...]


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to