Re: [Tutor] read in ascii and plot

2009-12-01 Thread questions anon
I would now like to add a line of best fit. I think the command is polyfit()?? But I can't seem to get it to work f=open('e:/testscatter.txt') data=[map(float,line.split()) for line in f] x, y=zip(*data) pylab.polyfit(x,y,1) pylab.scatter(x,y) pylab.show() Any feedback will be greatly appreciated

Re: [Tutor] read in ascii and plot

2009-12-01 Thread questions anon
Excellent thank you!! On Mon, Nov 30, 2009 at 7:03 PM, Kent Johnson wrote: > On Mon, Nov 30, 2009 at 8:26 PM, Wayne Werner > wrote: > > > A sample of the data is always helpful, but I'll take a shot in the dark. > > If you have data like this: > > 2.31 72 > > 9823 > > ... ..

Re: [Tutor] read in ascii and plot

2009-11-30 Thread Kent Johnson
On Mon, Nov 30, 2009 at 8:26 PM, Wayne Werner wrote: > A sample of the data is always helpful, but I'll take a shot in the dark. > If you have data like this: > 2.31     72 > 98        23 > ...         > 34        7.32 > And those are x y pairs you could do something like this: > f = open('i

Re: [Tutor] read in ascii and plot

2009-11-30 Thread Wayne Werner
On Mon, Nov 30, 2009 at 5:55 PM, questions anon wrote: > I would like to read in two columns of data from a *.txt file > > I type > > f=open("e:/testascii.txt") > import pylab > pylab.scatter(f) > > and then receive an error. > How do I point it to each column and do I need to do anything about th

[Tutor] read in ascii and plot

2009-11-30 Thread questions anon
I would like to read in two columns of data from a *.txt file I type f=open("e:/testascii.txt") import pylab pylab.scatter(f) and then receive an error. How do I point it to each column and do I need to do anything about the space gap between the two columns? Thanks in advance. _