Root 6 histogram error bars and fit functions

I’m trying to plot a histogram without the error bars and plot the results of the fitted function. The default drawing options for histograms in root 5 was to just plot the histogram and the fit function. Now, in root 6 the error bars are drawn by default.

At this point I can do this


draw the histogram without the error bars

if I do


I get the fitted function and the error bars.

if I do a

pHist->Draw(“HIST FUNC”)

I get no function since HIST disables the drawing of functions…

any ideas guys?


To reply to my own post, I figured out the nuance.

the way I created my histograms was using the following fill form


This is because I had an array of values which I wanted to cast into a histogram.

I changed my code to

for (Idx=0;Idx<Array[Bin-1];Idx++)

and now when I fit the histogram and draw it

I get a histogram drawn with no errors and the fit function superimposed.

anyway, I guess I should use ->SetBinContent instead of ->Fill(Bin,BinContent);

You could even copy your Array into fArray of the histogram. Either way - :+1: for solving it yourself and apologies for not receiving any help from us :frowning:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.