void TestMultiGraph() { Double_t x1[20] = {1.2, 1.3, 1.4, 1.6, 1.8, 2.3, 2.5, 3, 4, 6, 7, 8, 10,11, 14, 15, 18, 20, 21.3, 22}; Double_t y1[20] = {2.3, 4.3, 6.3, 30, 80, 150, 500, 2300, 5000, 3020, 600, 120, 80,30, 12, 1, 1e-1, 2e-2, 3.4e-3, 1e-5}; Double_t ex1[20] = {0.02, 0.02, 0.03, 0.03, 0.05, 0.05, 0.03, 0.02, 0.02, 0.02, 0.01, 0.02, 0.01, 0.04, 0.05, 0.02, 0.02, 0.02, 0.01, 0.01}; Double_t ey1[20] = {2, 2., 3, 3, 5., 7, 6e2, 2, 3, 2, 1, 2, 1, 4, 5, 2, 2, 2, 2, 1}; Double_t x2[20], y2[20]; Double_t x3[20], y3[20]; for (Int_t i=0; i<20; i++) { x2[i] = x1[i]*1.5; y2[i] = y1[i]*2.4; x3[i] = x1[i]+3.2; y3[i] = y1[i] + 5; } TGraphErrors *gr1 = new TGraphErrors(20, x1, y1, ex1, ey1); TGraphErrors *gr2 = new TGraphErrors(20, x2, y2, ex1, ey1); TGraphErrors *gr3 = new TGraphErrors(20, x3, y3, ex1, ey1); gr1->SetTitle("Graph1"); gr1->SetMarkerColor(1); gr1->SetMarkerStyle(22); gr1->SetMarkerSize(1.2); gr2->SetTitle("Graph2"); gr2->SetMarkerColor(2); gr2->SetMarkerStyle(22); gr2->SetMarkerSize(1.2); gr3->SetTitle("Graph3"); gr3->SetMarkerColor(4); gr3->SetMarkerStyle(22); gr3->SetMarkerSize(1.2); TMultiGraph *mg = new TMultiGraph(); mg->Add(gr1,"PL"); mg->Add(gr2,"PL"); mg->Add(gr3,"PL"); mg->SetTitle("All 3 Graphs"); TCanvas *canvas = new TCanvas("Test of Multigraph"); canvas->Clear(); canvas->Divide(2,2); canvas->cd(1); gPad->SetLogy(1); gr1->Draw("APL"); canvas->cd(2); gPad->SetLogy(1); gr2->Draw("APL"); canvas->cd(3); gPad->SetLogy(1); gr3->Draw("APL"); canvas->cd(4); gPad->SetLogy(1); mg->Draw("AP"); return; }