How can I create a script for multiple graph on single graph

I want to create two graph script on single graph.Here I also attaching my script in which I defined two graph but on running I got only one graph.
combined.C (776 Bytes)

void combined()
{
   TCanvas *c1= new TCanvas("c1","comparison graph of D0 pT spectra",700,500);

   const Int_t n = 9;
   Float_t x1[n] = {0.179335, 0.301069, 0.538599, 0.9038, 1.02257, 1.14133, 1.74109, 1.86283, 2.34086};
   Float_t y1[n] = {0.0918845, 0.0876225, 0.0506373, 0.030292, 0.0137459, 0.0115158, 0.00747785, 0.00719284, 0.00577122};
   Float_t x2[n] = {1.5, 2.5, 3.5, 4.5, 5.5, 7,10, 14, 20};
   Float_t y2[n] = {2.65, 1.03, 0.262, 0.0744, 0.0226, 0.00646, 0.00152, 0.000258, 0.0000716};

   auto gr1 = new TGraph(n,x1,y1);
   auto gr2 = new TGraph(n,x2,y2);
   gr1->SetMarkerColor(1);
   gr2->SetMarkerColor(4);
   auto mg = new TMultiGraph();
   mg->Add(gr1,"C*");
   mg->Add(gr2,"C*");
   mg->Draw("A");
}

Thank you for your quick help.

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