Today I spend quite some time to create a sqare version of a plot that previously was rectangular. A complication was that it’s features (text sizes, label offset, dimensions of the legend, …) needed to match another rectangular plot.
Aparrently the font sizes (and the other features) change with the canvas area! This forced me to do quite some painful re-scaling. This snippet illustrates what I mean (pay attention to how the x title is covered by the labels after the scaling to guess the pain ):
sure, see root.cern.ch/root/html/TAttText#T4 What you want is precision 3: like that the font size is not a function of the canvas size but in pixels and thus absolute.
Thanks, I indeed learned a new trick! I didn’t know the font number was actually a code, whith the last digit encoding the “precision”. For the record, now the code looks like this:
TCanvas *c2 = new TCanvas("c2", "c2", 640, 480);
TH1F *h2 = new TH1F("h2", "h2", 100, 0, 100);
h2->GetXaxis()->SetTitle("x");
// h2->GetXaxis()->SetLabelSize(0.05/480.*640.);
h2->GetXaxis()->SetLabelFont(133);
h2->GetXaxis()->SetLabelSize(30);
h2->Draw();
}[/code]
However, the margins still scale with the pad size…