Set text size relative to canvas, not pad

Text size is, by default, set relative to the pad. This can cause the font size to differ across pads of different sizes drawn on the same canvas. Is there a way to cause all pads to use the same font size? Or to specify that they should be determined relative to a certain canvas instead of the pad? Reproducer below.


import ROOT as r
h = r.TH1F("h", "h", 100, -10, 10)
h.FillRandom("gaus")
c = r.TCanvas()
p1 = r.TPad("p1", "p1", 0, 0.3, 1, 1)
p2 = r.TPad("p2", "p2", 0, 0, 1, 0.3)
p1.cd()
h.Draw()
p2.cd()
h.Draw()
c.cd()
p1.Draw()
p2.Draw()
c.Update()

If you use the font precision 3 you can specify the font size in pixel.
There is many examples on the forum.

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