Histogram height in Pad

Hi,

I was trying to enlarge the labels of the X axis of some plots

frame->GetXaxis()->SetLabelWidth(0.08)

but unfortunately the labels are cut by the Pad limit.
I tried enlarging the Pad bottom margin

mypad->SetBottomMargin(1);

but even if I set it to the maximum value (1), the labels are cut the pad.
I can manage to fix this by reducing the histogram height, using the mouse
and then dragging the histogram up.
With reduced histogram height, labels can fit inside the Pad.

However I’d like to do this inside my macro and not “by hand”.
May you please point me to the relevant methods to be used?

Thanks!

Cheers,

Pietro

Once you have done the right changes using the mouse, save the Canvas as a .C file from the menu File->Save->canvasname.C
Then you can take in the macro canvasname.C the settings you like.

Hi,

I already tried this, I noticed that the method used in the canvasname.C to move the pad is Range()
However I cannot reproduce this in my macro.
Using canvasname.C to replot the figure is quite unpractical since I read histograms from file,
while canvasname.C fill them as points.

Pietro

no … Range() defines the Pad range … you shoul have some "Margin"s methods in you C file.

I saved two distinct .C files, one with the output of the standard macro and the other one
with the macro where I resized “by hand” the histogram.

diff gives

[biassoni@pcbabar9 figure]$ diff c1.C c1b.C
3c3
< //========= (Thu Jun 3 15:08:03 2010) by ROOT version5.22/00

//========= (Thu Jun 3 15:07:28 2010) by ROOT version5.22/00
15c15
< pad->Range(2.313808,-577.3482,4.188285,1908.784);


pad->Range(2.3125,-208.405,4.1875,1875.645);
19d18
< pad->SetBottomMargin(0.2322275);

However pad->SetBottomMargin(0.2322275); doesn’t sort any effect in the original macro.
as already said neither pad->SetBottomMargin(1) works

Can you post a small (working) macro reproducing your problem ?

Hi,

I eventually solved the problem by chance.
I report the solution for future recording.

In the original macro I did

mypad->SetBottomMargin(1);
frame->GetXaxis()->SetLabelWidth(0.08)

and this couldn’t manage the problem described above.
Switching the order of the commands

frame->GetXaxis()->SetLabelWidth(0.08)
mypad->SetBottomMargin(1);

fixes the problem.

Thanks for your support

Pietro