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: [...] /data/ycopin/Softs/local/lib/python2.4/site-packages/matplotlib/colors.pyc in to_rgba_array(self, c, alpha) 377 if isinstance(c, np.ndarray): 378 if c.ndim != 2 and c.dtype.kind not in 'SU': --> 379 raise ValueError("Color array must be two-dimensional") 380 if (c.ndim == 2 and c.shape[1] == 4 and c.dtype.kind == 'f'): 381 if (c.ravel() > 1).any() or (c.ravel() < 0).any(): ValueError: Color array must be two-dimensional So my question is: is the documentation just outdated, or is it a regression in scatter? Cheers, -- .~. Yannick COPIN (o:>* Doctus cum libro /V\ Institut de physique nucléaire de Lyon // \\ Université de Lyon - CNRS-IN2P3 /( )\ AIM: YnCopin ICQ: 236931013 ^`~'^ http://snovae.in2p3.fr/ycopin/ ------------------------------------------------------------------------------ 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