Reading an ASCII file and make a graph

Hi,

I am trying to read an ASCII file which has an X column and several Y columns which I would like to plot on one graph (a file is attached), but I do not know how to do it. Most of the available examples show how to read an ASCII file with several columns and plot a histogram. I do not need a histogram, I just need to be able to plot several lines on one graph as Y vs X. Please let me know hot to do it.

Thank you very much in advance!

Kirill
test.txt (421 Bytes)

Step 1: Check the documentation http://root.cern.ch/root/html/TGraph.html#TGraph:TGraph@10
Step 2: There is a hint on how to extract specific columns only.

root [3] TGraph g1("test.txt", "%lg %lg")
root [4] TGraph g2("test.txt", "%lg %*lg %lg")
root [5] TGraph g3("test.txt", "%lg %*lg %*lg %lg")
2 Likes