Rescale TCanvas fonts etc for small plots


Is there a global, easy and consistent way to rescale all objects on a canvas, so that histograms/graphs can be made small, while preserving the text size of axis labels etc? So for example, with axes, the tick marks should be recomputed.

The objective is to have lots of histograms on one page, where visual comparisons can be made, with just essential axis marks and statistics displayed. It doesn’t seem immediately easy to do.

I’ve played with TStyle, but don’t have much luck. Methods I’ve tried out are, amongst others,

Hopefully someone can understand what I want!


I am not completely sure to understand, but if you just want to plot histograms next to each other in oder to compare them use Divide() as explain here:

No, sadly that’s not what I meant. In fact, I already have lots of histograms next to each other in this manner. And when I look at the result, all the text and markers have got squeezed down so that they’re almost illegible. I want a less cluttered canvas, with larger text.

To change global settings you should use gStyle->SetXyz. For instance the label size is set via: … tLabelSize
See all the available setting here:

SetLabelSize() seems to work erratically… weird.

In any case, now all the labels overlap each other, so I still have to manually iterate over the axes and other objects to reduce the tick mark spacing, label offsets etc.

The scenario is as if I were making a plots for someone with poor eyesight, but where the absolute canvas size must be preserved.

It doesn’t seem to be possible in ROOT, at least, not via gStyle.

All the global settings can be change using gStyle. look at the long list at in the URL I sent you. settings the label size is surely not enough. It was just a example. Can you provide some small running macro ? I will try to add the necessary settings in it.

My guess is that your problems will be solved if you specify the text size in pixels for the objects like axis labels that you do not want to see resized when you grow/shrink the canvas.
For example, you can specify the axis labels fonts/sizes in pixels either via gStyle or like

myHist->GetXaxis->SetLabelfont(53); //font is in pixel (see TAttText) myHist->GetXaxis->SetLabelSize(12); //labels will be 12 pixels

I’m running into a similar problem. I can adjust the fonts to the size I want, but that requires offsetting the Yaxis title by such an amount that it’s partially out of the Canvas (figure). I’ve not found a way to reduce the size of the Frame automatically so that everything fits in the Canvas; I can do it with the mouse… but it’s an impractical solution for the hundreds of plots I want to make.

Is there any function in gStyle that would do this? I can’t find any.


Give systematically a wider left margin to your pads

mypad->SetLeftMargin(0.15); or in your style