Hi Jeehoon,
you draw the histogram, not an ntuple - thus ask the histogram for the title. I cannot tell how you create the histogram - but this should work, assuming that you know the name of the histogram (in my example I call it "htemp"):
TH1* hist = (TH1*) gPad->GetListOfPrimitives()->FindObject("htemp"); hist->GetXaxis()->SetTitle("my x axis"); gPad->Update()
Alternatively you can define the title when constructing the histogram by setting the "title" parameter properly. Quoting from <http://root.cern.ch/root/html/TH1.html#TH1:TH1>: if title is of the form "stringt;stringx;stringy;stringz" the histogram title is set to stringt, the x axis title to stringy, the y axis title to stringy, etc.
Cheers, Axel.
jhkim_at_physics.utexas.edu wrote on 09/15/2010 08:15 PM:
> Hi,
>
> I would like to change a x-axis title in a ntuple plot.
> I tried "ntuple->GetXaxis()->SetTitle("my x axis")";
> ,but it didn't work.
>
> How can I do that?
>
> Best,
>
> Jeehoon
>
>
Received on Thu Sep 16 2010 - 10:20:19 CEST
This archive was generated by hypermail 2.2.0 : Fri Sep 17 2010 - 17:50:01 CEST