I wasn't quite able to follow exactly what you wanted to do but maybe this
will help. I am going to generate some "data" that I think sounds a bit like
yours, write it to a file, clearly you already have this. Then I am going to
read it back in and plot it, e.g.

import matplotlib.pyplot as plt
import numpy as np

# Generate some data a little like yours, I think? 
# print it to a file, i.e. I am making your myfile.txt
numrows = 100
numcols = 8
mass = np.random.normal(0, 1, (numrows  * numcols)).reshape(numrows,
numcols)
f = open("myfile.txt", "w")
for i in xrange(numrows):
    for j in xrange(numcols):
        print >>f,  mass[i,j],
    print >> f
f.close()    

# read the file back in
mass = np.loadtxt("myfile.txt")

# plot the 8th column
fig = plt.figure()
ax = fig.add_subplot(111)
ax.plot(mass[:,7], 'r-o')
ax.set_xlabel("Time")
ax.set_ylabel("Mass")
plt.show()


I wasn't clear on the mean bit, but that is easy to do with numpy, e.g. 

mean_mass = np.mean(mass[:,8])

etc.

Numpy et al is great for stuff like this.

Hope that helps,

Martin

-- 
View this message in context: 
http://old.nabble.com/How-do-you-Plot-data-generated-by-a-python-script--tp32328822p32331474.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@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to