From: John H. <jd...@gm...> - 2008-06-21 19:26:56
|
On Fri, Jun 20, 2008 at 6:14 PM, sordnay <so...@gm...> wrote: > > Hi all, > I'm trying to plot in 2D, 3 variables from time series, instead of volume I > want color for the third variable. > I have partial success with a scatter plot, but I'm unable to manage the > colorbar so it represents z values, > I needed to sort the variables and it's getting a bit ugly, so I though I > might be missing some other function ? > this is what I used: > pylab.figure() > x=self.stData.[items[0]] > y=self.stData.[items[1]] > z=self.stData.[items[2]] > points=zip(x,y) > points3=sorted(zip(z,points)) > for i,p in enumerate(points3): > z[i]=p[0] > x[i]=p[1][0] > y[i]=p[1][1] > #colors=pylab.linspace(z.min(),z.max(),len(z)) did not work > colors=pylab.linspace(0,1,len(z)) > pylab.scatter(x,y,c=colors,faceted=False) Just pass c=z to scatter if z are the values you want to colormap. JDH |