Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.
Close
From: sordnay <sordnay@gm...>  20080620 23:58:50

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) pylab.colorbar() pylab.show() but even if I could get the colorbar ticks to represent z values, in fact this is not correct as this gives every point "one" color, and this is not correct...  View this message in context: http://www.nabble.com/colorxyplottp18038983p18038983.html Sent from the matplotlib  users mailing list archive at Nabble.com. 
From: John Hunter <jdh2358@gm...>  20080621 19:26:56

On Fri, Jun 20, 2008 at 6:14 PM, sordnay <sordnay@...> 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 
From: sordnay <sordnay@gm...>  20080627 18:43:19

John Hunter4 wrote: > > On Fri, Jun 20, 2008 at 6:14 PM, sordnay <sordnay@...> 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 > >  > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > http://sourceforge.net/services/buy/index.php > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > yes it was lot easier, but i had to set the vmin and vmax kwargs or it wouldn't work: sigbrowse=figure() x=self.stData.Data[items[0]] y=self.stData.Data[items[1]] z=self.stData.Data[items[2]] scatter(x,y,c=z,faceted=False,vmin=z.min(),vmax=z.max()) colorbar() show()  View this message in context: http://www.nabble.com/colorxyplottp18047665p18161452.html Sent from the matplotlib  users mailing list archive at Nabble.com. 
From: John [H2O] <washakie@gm...>  20101026 21:26:34

Bringing up an old thread, but just curious if this can be done with the plot command as well, as in: plt.plot(X,Y[1:3,:].T,c=['blue','red']) Thanks, john sordnay wrote: > > > John Hunter4 wrote: >> >> On Fri, Jun 20, 2008 at 6:14 PM, sordnay <sordnay@...> 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 >> >>  >> Check out the new SourceForge.net Marketplace. >> It's the best place to buy or sell services for >> just about anything Open Source. >> http://sourceforge.net/services/buy/index.php >> _______________________________________________ >> Matplotlibusers mailing list >> Matplotlibusers@... >> https://lists.sourceforge.net/lists/listinfo/matplotlibusers >> >> > > yes it was lot easier, but i had to set the vmin and vmax kwargs or it > wouldn't work: > sigbrowse=figure() > x=self.stData.Data[items[0]] > y=self.stData.Data[items[1]] > z=self.stData.Data[items[2]] > scatter(x,y,c=z,faceted=False,vmin=z.min(),vmax=z.max()) > colorbar() > show() > >  View this message in context: http://old.nabble.com/colorxyplottp18047665p30061906.html Sent from the matplotlib  users mailing list archive at Nabble.com. 