Text size on plots

Dear ROOT team,

I would like to ask about how to scale text in different pads in a canvas so that the absolute text size was exactly the same on the output picture. By text I mean: axes labels and titles, TLatex, legend.
I attach a macro that could serve as an example. It splits the mother canvas into two pads that have exactly the same size of the rectangles delimited by axes. Therefore, the pads have different size. Therefore, the absolute text size is different. I scale the text size by gPad.GetAbsWNDC() in each pad but it is not sufficient. See e.g. the axes titles in the output plots test.eps. How should I scale the text size of different objects so that the text size on the output plot was all the same?
Thank you for your help.
Best regards

Vojtech Pleskot
test.py (8.91 KB)

Dear Vojtech,

I will let our graphics expert reply to this question once back, in a couple of weeks…

Cheers, Bertrand.


Thanks Rene who pointed out the fact that you can specify the absolute text size (in pixel). Did you try to use SetTextSizePixels()
And read also the documentation of the Text Attributes class , and more specially the Text Font and Precision part.

Cheers, Bertrand.

Use the text font precision number 3
For instance 43 instead of 42
See the TAttText ref manual

Dear all,

thank you for your answers. According to them, I started to set the text size in pixels.
However, I wander why isn't it possible (or easy) to set the text font relative to pads and obtain the same text size through a scaling factor? Does it mean that the calculation of the real text size is non-linear when using the option "relative to a pad"?
Best regards


The text sise is a % of the pad size. If you change the pad size or if you have to pads with different sizes on the same canvas then you get visually different text sizes. On when you set the text size pixels, you get the same size whatever the canvas size is.