Plot more than one data set

Hello ROOTers,

I’m trying to plot two and more data set in txt format:

{
  	 
  	TFile f("Plot_DataThief.root","RECREATE"); 
	  
    TCanvas c("c", "Grafico Random", 700, 500);
	
    TTree t("t","a simple tree");

  	TGraphErrors g("Christensen_1977.txt", "%lg %lg %lg %lg");
    TGraphErrors h("Patterson_1971.txt", "%lg %lg %lg %lg");
  	
    g.GetXaxis()->SetTitle("E_{c.m.} [MeV]");
  	g.GetYaxis()->SetTitle("S(E) [MeV barn]");
  	g.SetTitle("Plot DataThief");
  	g.Draw("ap*");

        h.Draw("ap");

  	t.Write();
  	
  	f.Close();

}	

but if i run the code I obtain:

c.pdf (14,5 KB)

I don’t see the first data set. Here you can find datasets and code: Christensen_1977.txt (514 Byte) DataThief.C (1,3 KB) Patterson_1971.txt (804 Byte)

Someone can help me please?

ROOT Version: v6-20-04
Platform: Xubuntu 20.04
Compiler: gcc version 9.3.0

h.Draw("P");

Now it works, another question, i’m trying to reply this plot:

and I’m trying to fix y axis, I’m using:

g.GetYaxis()->SetRangeUser(1e19,2e20);

But this line code don’t fix the axis:

Why this? Here there is the code: DataThief.C (1,4 KB)

g.SetMaximum(2e20);
g.SetMinimum(1e19);

Thank you at all!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.