Draw("same") in TCanvas

Dear Rooter,
I have a seemed simple question but I really don’t know how to solve it. Recently I want to draw 8 plots and I divide my canvas by 2x2, and each cell should have two graphs in order to make clear comparison. I have thought I should simply apply, for example,
TCanvas * c3 = new TCanvas(“canvas3”,“canvas3”,50,50,500,450);
c3->Divide(2,2);
c3->cd(1);
peak1_os_cc->SetTitle(“os_cc peak sdv”);
peak1_os_cc->GetXaxis()->SetTitle(“centrality”);
peak1_os_cc->GetYaxis()->SetTitle(“standard deviation”);
peak1_os_cc->SetMarkerColor(3);
peak1_os_cc->SetMarkerStyle(8);
peak2_os_cc->SetMarkerColor(4);
peak2_os_cc->SetMarkerStyle(8);
peak1_os_cc->Fit(“f1”,"","",0,80);
peak1_os_cc->Draw(“AP”);
peak2_os_cc->Draw(“same”);
but it doesn’t work. Can you guys help me?

If you use TGraph and not TH1, use “peak2_os_cc->Draw(“P”);” instead of Draw(“same”)

I do use TGraph, but after I try peak2_os_cc->Draw(“p”) it still gives me only the peak1_os_cc plot.

[...]
peak1_os_cc->SetMarkerStye(20);
peak1_os_cc->SetMarkerColor(2);
peak1_os_cc->Draw("AP");
peak2_os_cc->SetMarkerStye(21);
peak2_os_cc->SetMarkerColor(3);
peak2_os_cc->Draw();
[...]

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