X-axis title of the bottom pad going out of canvas

Hi,

I divided a Canvas into 2 pads where in the top pad I have some plot while in the bottom pad, I have their ratio. The issue is the I am unable to view the title of X-axis of the bottom pad. I can see the labelling of the X-axis but not the title. But on manually adjusting on canvas when it gets displayed, I see that the title exists. Its just that it goes outside the canvas. How can I force the histogram in the bottom pad to be slightly shorter such the there is space for the title to accommodate? Following is the code for reference.

TCanvas* canvas2 = new TCanvas("canvas2","canvas2",900,900);

canvas2->Divide(1,2);
canvas2->cd(1);
gPad->SetPad(0.0,0.2,1.0,0.96);
gPad->SetBottomMargin(0);

//Add histogram in the top pad (No issues upto here)` 
   
canvas2->cd(2);
gPad->SetPad(0.0,0.0,1.0,0.2);
gPad->SetTopMargin(0)

//Add histogram(d1) in the bottom pad.

d1->SetStats(0);
d1->SetLineColor(kBlack);
d1->SetTitle("");
d1->GetXaxis()->SetLabelSize(0.12);
d1->GetXaxis()->SetTitle("mass");//Setting the title
d1->GetXaxis()->SetTitleSize(0.12);
d1->GetXaxis()->SetTickLength(0.03);
d1->GetYaxis()->SetTitle("Data/MC");
d1->GetYaxis()->CenterTitle();
d1->GetYaxis()->SetTitleSize(0.12);
d1->GetYaxis()->SetLabelSize(0.12);
d1->GetYaxis()->SetTitleOffset(0.38);
d1->GetYaxis()->SetNdivisions(404);
d1->Draw("LEP");
canvas2->Draw();

`

Thank you very much!

`

Please provide the following information:


ROOT Version (e.g. 6.06/02):
_

Hi,

gPad->SetBottomMargin(…) works!

Thanks!

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