Alphanumeric labels in TGraphError

Hi,

I’m trying to put alphanumeric axis labels in a TGraphErrors (or a TGraph) using SetBinLabel. It works like “point and click” :slight_smile: in the TH* histogram classes, but it’s not so trivial for TGraph classes. It there an obvious way to do this, or does it involve getting the TGraph* number of bins, bin width, etc. ?

Thanks in advance.

By definition, TGraph, TGraphErrors are unbinned objects, so setBinlabel
does not make sense.
Use a TH1 instead if you have binned values.

Rene

Hi,

I suppose this means I have to superimpose a TGraphError with a TH1, since the histogram classes don’t seem to have means to produce error bars. Is this correct? (It’s not pretty, but at least it should work.)

histograms can have error bars. Please see the ROOT tutorials, eg
hsum.C, h1draw.C, etc

Rene

[quote=“brun”]histograms can have error bars. Please see the ROOT tutorials, eg
hsum.C, h1draw.C, etc
[/quote]

Hi again Rene, and thanks for your help.

I’m sorry to be such a bore, but I still have another question – about TH1 error bars. I gathered that the error bars are computed by ROOT based on the contents of a bin. What if I want to specify the error for a measurement stored in a bin?

I.e., if I do a fill h1->Fill(x,w) it fills the bin x (e.g. event number, I’m working with a very small sample of one dozen) with a given weight w (e.g. mass of a pair of tracks). Is there a way to tell the TH1 histogram that “don’t figure out the measurement error for me, I want to fill bin x with weight w and error e” ?

Thanks again! :slight_smile:

Hi,
see TH1::SetBinContent() and TH1::SetBinError().
Axel.

[quote=“Axel”]Hi,
see TH1::SetBinContent() and TH1::SetBinError().
[/quote]

Hi Axel, thanks for your answer.

Have pacience with the newbies …