Draw histogram with e1 option - option ignored

Hi,

I am trying to plot a histogram with the “E1” option so that the error bars are shown with small bars at the end. However, it seems that ROOT is ignoring this option.

If I just do

h = TH1F("h","",10,0,10)
h.Fill(5,5)
h.SetMarkerStyle(21)
h.Draw(" p e1")

The error is just drawn “normally”, no ticks at the end of the error bars. Is there some trick I am missing?

I am using ROOT version 5.32/03 and see same behaviour in pyroot and ROOT.

Kind regards
Maiken

[quote=“maikenp”]Hi,

I am trying to plot a histogram with the “E1” option so that the error bars are shown with small bars at the end. However, it seems that ROOT is ignoring this option.

If I just do

h = TH1F("h","",10,0,10)
h.Fill(5,5)
h.SetMarkerStyle(21)
h.Draw(" p e1")

The error is just drawn “normally”, no ticks at the end of the error bars. Is there some trick I am missing?

I am using ROOT version 5.32/03 and see same behaviour in pyroot and ROOT.

Kind regards
Maiken[/quote]

EDIT: text removed, since the original “code” runs as expected and generates the expected output (see the OP’s reply below). …

with this macro:

void hist()
{
   TH1F * hist = new TH1F("h", "", 10, 0., 10.);
   hist->FillRandom("gaus");
   hist->SetMarkerStyle(21);
   hist->Draw("pe1");
}

I’m not quite sure, what do you mean by ‘no ticks at the end of the error bars’, have a look at the picture I have.


Maiken’s code is valid PyROOT code (if you do “from ROOT import *”), so they are probably using that instead of CINT/C++. When I try it on my PyROOT it indeed gives the error bars with little crossbars at the ends.

Jean-François

Hi,

I realized that the problem was that I have a style-file that .rootlogon.C calls, which does

That explains my funny behaviour, and no ticks at the end of the error bars. Removing this line in my style file, I get what you get :slight_smile:

Sorry for the noise!
Maiken

[quote=“jfcaron”]Maiken’s code is valid PyROOT code (if you do “from ROOT import *”), so they are probably using that instead of CINT/C++. When I try it on my PyROOT it indeed gives the error bars with little crossbars at the ends.

Jean-François[/quote]

Yes, right, they’ve actually mentioned pyroot in the last sentence, I had to read more carefully.
The funny thing, though, that CINT can also execute the same code and you’ll have error bars as expected.