hist->Draw("P") drawing a marker in empty bins

Dear Rooters,
When I do

root is drawing me the attached histogram.
I don’t want the empty bins (which aren’t filled with any value) to have a marker drawn at them and I thought the “P” option would do this.
Is there any way of doing this or am I using the “P” option incorrectly?
RootHist.pdf (15.4 KB)

Why do you use a TH1 instead of a TGraph that seems far more appropriate for your data?


Hi Rene,

To be honest, it’s because I don’t like the way that TGraphs are filled- in that you have to pass an array to the constructor rather than a histogram where you can just call ->Fill() and so I have always used TH1,2… wherever possible to avoid complicating the code.

However looking at TGraphErrors I think it would handle my errors better so I might give it a whirl…

am I correct in believing when using this I can fill the TGraphErrors with my datapoints and associated errors, do a fit and then call GetErrorY to get the propagated errors (from the input errors) on the extrapolated datapoint y value at any value of x?

Are the return errors propagated from just the input measurement errors, the errors on the fit or both?

I have found the SetPoint() command so ignore the earlier comment- apologies…