SetTitleSize() makes my x-label disappear


Hi everyone,

I am trying to change the size of my x-label of my histogram of the form TH1D by using the following methods:

Line 1: h1->SetXTitle(" some string " );
Line 2: h1->SetTitleSize(0.15, “X”);

If I only use Line 1, then it sets my x-label to my string. However, when combining it with Line 2, it makes the whole label disappear. By looking at the documentation, SetTitleSize () takes in size and axis, in this case 0.15 and “X”. Furthermore, I get no errors whatsoever, so I do not know exactly what I am doing wrong. If anyone has an idea, please let me know.

Thanks in advance!


_ROOT Version:6.22/08
_Platform: Mac
Compiler: Not Provided

Set...Size() uses the size value as percentage of the canvas size. Your title is indeed drawn but you don’t see it because it’s too big and it goes too far below the histogram (you can see it by dragging up with the mouse the lower side of the histogram frame). So try with smaller values, like 0.05 or so, and/or increase the bottom margin distance (SetBottomMargin on the canvas or pad).

1 Like

Font precision 3 allows to define the text size pixel.

1 Like

Awesome! Thank you so much for the help @dastudillo @couet.