John Washakie wrote:
> Trying again, a little more detail:
> 
> I am trying to use the color setting feature of SCATTER:
> 
> colors=cm.spectral(linespace(0,100,len(x))
> 
> then, plotting:
> 
> scatter(x,y,c=colors)
> 
> I get the error:
> TypeError: c must be a matplotlib color arg or a sequence of them
> 
> But I don't understand.
> 
>> x.shape
>> (600,)
>> colors.shape
>> (600,4)
> 
> so it appears to me that colors is indeed a sequence of intensities
> the same length as x? What is wrong then??
No, colors is a sequence of colors in this example, and I think that 
even if it did not give an error, it would not do what you want; but 
yes, I don't think this should give an error.  And, on my system, a 
rough equivalent does not.  What mpl version are you using?

Regardless, I think what you want is more like this:

scatter(x, y, c=arange(len(x)), cmap=cm.spectral)

Then the colors will be determined from a table lookup in the spectral 
colormap based on the floating point values in c, with the smallest 
value mapped to the first color and the largest value mapped to tha last.

Eric

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to