On 3/9/07, Matthieu Brucher <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to plot a set of points, each point having a different color. > For the moment, I'm trying to do something like that : > > for indice in range(0, points.shape[0]): > pl.plot(points[indice, 0], points[indice, 1], 'o', c = > colours[indice,:], hold = True) > > where points is a numpy array of point and colours is a numpy array of > dimension (points.shape[0], 3) > > With Matlab, something like this would function, but not in matplotlib, it > tells me : > ValueError: need more than 0 values to unpack
Complete examples always help ince we have no way of knowing what the points data structures look like, but I'll hazard a gues. The x and y arguments to "plot" need to be sequences. Ie, something like plot([0.5], [0.5], 'ro') It can be inefficient to plot many separate points this way -- if you have a lot of points, use a matplotlib.collections.RegularPolyCollection or scatter. JDH ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users