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.

## Re: [Matplotlib-users] How do you Plot data generated by a python script?

 Re: [Matplotlib-users] How do you Plot data generated by a python script? From: surfcast23 - 2011-08-25 00:38:15 ```Thank you Gary. I will definitely read the numpy doucs Gary Ruben-2 wrote: > > As you show it, mass will be a string, so you'll need to convert it to > a float first, then add it to a list. You can then manipulate the > values in the list to compute your mean, or whatever, which matplotlib > can use as input to its plot() function or whichever type of plot > you're after. Alternatively, since the Python numpy module is made for > manipulating data like this, it can probably read your data in a > single function call and easily compute the things you want. However, > if you are really that new to programming, you may struggle, so I'd > suggest reading first going to scipy.org and reading up on numpy. When > you understand the basics of numpy, matplotlib's documentation should > make a lot more sense. > > Gary > > On Thu, Aug 25, 2011 at 6:48 AM, surfcast23 wrote: >> >> I am fairly new to programing and have a question regarding matplotlib. I >> wrote a python script that reads in data from the outfile of another >> program >> then prints out the data from one column. >> >> f = open( 'myfile.txt','r') >> for line in f: >> if line != ' ': >>  line = line.strip()       # Strips end of line character >>  columns = line.split() # Splits into coloumn >>  mass = columns[8]    # Column which contains mass values >>  print(mass) >> >> What I now need to do is have matplotlib take the values printed in >> 'mass' >> and plot number versus mean mass. I have read the documents on the >> matplotlib website, but they don't really address how to get data from a >> script(or I just did not see it) If anyone can point me to some >> documentation that explains how I do this it would be really appreciated. >>  Thanks in advance >> >> -- >> View this message in context: >> http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32328822.html >> Sent from the matplotlib - users mailing list archive at Nabble.com. >> >> >> ------------------------------------------------------------------------------ >> EMC VNX: the world's simplest storage, starting under \$10K >> The only unified storage solution that offers unified management >> Up to 160% more powerful than alternatives and 25% more efficient. >> Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev >> _______________________________________________ >> Matplotlib-users mailing list >> Matplotlib-users@... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >> > > ------------------------------------------------------------------------------ > EMC VNX: the world's simplest storage, starting under \$10K > The only unified storage solution that offers unified management > Up to 160% more powerful than alternatives and 25% more efficient. > Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev > _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > -- View this message in context: http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32330761.html Sent from the matplotlib - users mailing list archive at Nabble.com. ```