// example of script showing how to divide a canvas // into adjacent subpads + axis labels on the top and right side // of the pads. void zoneh() { TCanvas *c1 = new TCanvas("c1","multipads",900,700); gStyle->SetPadBorderMode(0); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1->Divide(2,2,0,0); TH1F *h1 = new TH1F("h1","test1",20,-3,3); h1->SetMarkerStyle(21); h1->Sumw2(); TH1F *h2 = (TH1F*)h1->Clone("h2"); TH1F *h3 = (TH1F*)h1->Clone("h3"); TH1F *h4 = (TH1F*)h1->Clone("h4"); h1->FillRandom("gaus",500); h1->SetMaximum(80); h2->FillRandom("gaus",300); h2->SetMaximum(80); h3->FillRandom("gaus",900); h3->SetMaximum(130); h4->FillRandom("gaus",500); h4->SetMaximum(130); c1->cd(1); gPad->SetBottomMargin(0); gPad->SetRightMargin(0); gPad->SetTickx(); h1->GetYaxis()->SetTitle("Number of events"); h1->Draw(); c1->cd(2); gPad->SetLeftMargin(0); gPad->SetBottomMargin(0); gPad->SetTickx(); gPad->SetTicky(); h2->GetYaxis()->SetLabelOffset(0.01); h2->Draw(); c1->cd(3); gPad->SetTopMargin(0); gPad->SetRightMargin(0); gPad->SetGridx(); gPad->SetGridy(); h3->Draw(); c1->cd(4); gPad->SetLeftMargin(0); gPad->SetTopMargin(0); gPad->SetTicky(); gPad->SetGridx(); gPad->SetGridy(); h4->GetXaxis()->SetTitle("X title"); h4->Draw(); }