How to plot Graph from text file

I have a text file. data.txt (82 Bytes) . I save it in C:\root_v5.34.36\macros. I want to plot Graph from that file but i am not successful. This is my macros file em.C (50 Bytes) . Who can help me resolve this problem? Thank you.___
Please read tips for efficient and successful posting and posting code

ROOT Version: 5.34.36
Platform: win 10
Compiler: Not Provided

  TGraph *g = new TGraph("data.txt");

Thank you. I ran a command .x em.C in Root, but i didn’t recieve anything, Root also disappeared. I took this screen photo

. Is this a error in Win 10?

It says it could not find the “data.txt” file. Before you start ROOT, you need to “cd” to the directory in which you keep this file or you need to use the full path to it in your macro.

Thanks a lot. I have to put file data.text directly in C:\root_v5.34.36. Now i can run file.

you can also specify the file name path:

TGraph *g = new TGraph("/path/where/my/file/sits/data.txt");
1 Like