[ROOT] Scaling TTF with SetTextSize

From: Steffen Grohmann (steffen.grohmann@cern.ch)
Date: Thu Mar 21 2002 - 13:08:28 MET


Hello,

Setting TTF size of titles and axis labels in histograms and graphs, I
have to enter relative values according to the NDC:

e.g. graph1->GetXaxis()->SetTitleFont(22);
     graph1->GetXaxis()->SetTitleSize(0.04);

Now, if I have two graphs in one canvas, which do not have the same
size, the same values of SetTitleSize() result in different text sizes
in the two graphs due to the different NDCs.
Trying to find a conversion factor I noticed that the ratio of the
diagonals (in pixel dimensions) seems to work quite well:

e.g. d1 = sqrt(deltax1^2 + deltay1^2) {measured by hand from a plot}
     d2 = sqrt(deltax2^2 + deltay2^2) { -"- }
     graph1->GetXaxis()->SetTitleFont(22);
     graph1->GetXaxis()->SetTitleSize(0.04);
     graph2->GetXaxis()->SetTitleFont(22);
     graph2->GetXaxis()->SetTitleSize(0.04*d1/d2);

This is a rather awkward procedure, where I didn't manage to
automatically retrieve the deltax and deltay values.

Is there any method to define the text size of TTF as an absolute size
in order to have consistent text scaling in a canvas of multiple graphs?

I noticed a difference for using TPaveLabels and TPaveText as well. For
TPaveText the scaling seems to follow the scaling of the graph, whereas
the text scaling in TPaveLabels seems to depend on the height of the
label.

I think it would be handy to be able to scale the text with the size of
the entire canvas to have the same sizes in all sub-pads.

Regards, Steffen



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:46 MET