Label size depending on TPad size

Hi all.

I want to plot several histograms in different ways in one code.
Some of them shall go onto the whole canvas. Others, e.g. comparing
two histograms, should require to split the canvas in two pads first,
one (the larger of the two, say 70% of the canvas space) where the two histograms
are drawn on top of each other and one (the smaller one, 30% of space) where
a ratio of the two histograms is plotted such that one can see how different
the distributions are. In the first case where I just plot a histogram, I can
arrange all the styling and cosmetics issues, i.e. I set the label and title sizes
and offsets of the axes, put some additional text and such.

However! for the second case, where I move from one to two pads, I cannot
just take the same values for the labelsize or titlesizes as they depend on the
space occupied by the pad, the smaller the pad is, the smaller the labels will
be for a fixed argument given to hist.GetXaxis().SetLabelSize(), .SetTitleSize() etc.
So my values that I use in the first case are useless here. And especially, I need
two sets of values one for the histogram in the upper/larger and one for the
ratio histogram in the lower/smaller pad.

So I have two questions.
(1) Is there a way to fix the text sizes and offsets and such in an “absolute” way
rather than w.r.t. the size of the pad where the histogram is drawn in?
(2) If not, and if those values have to depend on the pad one is working in, can
I somehow retrieve the integral/space of the current histogram (gPad) I am
trying to draw the histogram in? Then I just need to take the first set of
values and divide/multiply by the different integrals and done.

Thank you very much for your help!

OK, I found a way. The area of the pad i can get via the product of
TPad::GetWNDC() and TPad::GetHNDC() and then I correct the fixed
sizes I have by that factor.


You can also use font precision number 3 which allows to define you the text size in dot.s