By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,728 Members | 1,134 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,728 IT Pros & Developers. It's quick & easy.

Re: Taking the floating point distances and plotting histogram

P: n/a
aditya shukla wrote:
I have a program whose output is stored in a text file , say test.txt
eg.
0\9\10\11|0.50|c:\windows\apppatch/AcLayers.dll
0\9\10\11|0.50|c:\windows\apppatch/AcRedir.dll
0\9\10|0.66|c:\windows\apppatch/AcSpecfc.dll
0\9|0.83|c:\windows\apppatch/iebrshim.dll

After reading this text file i need to extract the float point values
from each line ie , 0.50,0.50,0.66.0.83 <http://0.66.0.83respectively
in this case, till the end of the file is reached and then i need to
plot a histogram based on these values .
Extracting is easy; you can do something like

data = []
for line in open("test.txt"):
line = line.split("|")
data.append(float(line[1]))

(or maybe use the csv module with a custom separator)

Plotting is a bit different -- there are many ways to do that, depending
on where and how you want to display that histogram (on a website, in a
window on your machine, in a PDF file, ...), but most solutions require
additional libraries. Here's one such library:

http://matplotlib.sourceforge.net/

</F>

Jul 23 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.