gStyle->SetLabelSize(x) only affects x-axis in TH1F

Hi,

I modified the default label size (size of the numbers on the axes) using gStyle->SetLabelSize(0.06), so that the numbers on the axes of some histo’s I saved to file earlier would appear bigger. This seems to affect the x-axis only though.

Here’s a simple example demonstrating the problem:

root [0] TH1F h(“a”,“A”,10,0,1)
root [1] h->Fill(0.5)
root [2] h->Fill(0.5)
root [3] h->Fill(0.5)
root [4] h->Draw()
root [5] gStyle->SetLabelSize(0.1)
root [6] h.UseCurrentStyle()
root [7] h->Draw()

The result is attached. Clearly, only the x-axis labels have obtained the new size.
I guess I’ll get what I want by doing h.GetYaxis()->SetLabelSize(0.1), but it would be nice if setting the gStyle would work properly.

Thanks!

Paul
labelsize.ps (10.8 KB)

A different problem with axes:

I set the title offset (distance of the text on an axis to the axis) of the x-axis of a histogram. After I rebin the histogram, the title offset is reset to the default value.

root [0] TH1F h(“a”,“A”,10,0,1)
root [1] h.GetXaxis()->GetTitleOffset()
(const Float_t)1.00000000000000000e+00
root [2] h.GetXaxis()->SetTitleOffset(2)
root [3] h.GetXaxis()->GetTitleOffset()
(const Float_t)2.00000000000000000e+00
root [4] h.Rebin(2)
(class TH1*)0x8a6cf48
root [5] h.GetXaxis()->GetTitleOffset()
(const Float_t)1.00000000000000000e+00

I’m using root v3.05/04 on Red Hat 7.3.
Thanks-

Paul

Paul,

Currently Rebin resets the axis attributes. I will fix this

Rene

Hello Rene,

Thanks.
Please have a look at my first post also, regarding the Y-axis label size.

(and sorry for posting two problems under one topic)

Cheers,

Paul

About TStyle::SetLabelSize, see the function,
The second argument (default=“x”) specifies the axis.
In your case, you must set the “y” axis too.

Rene

Hi,

You’re right, adding
gStyle->SetLabelSize(mysize, “Y”);
does it.
Thanks!

Paul