RooDataSet plots


I am trying to plot my data, giving a few options with DrawOption:,

RooPlot* frame = topMass->frame(Bins(20),Title(“Mass distribution”)) ;
data->plotOn(frame, DrawOption(“Zp”)) ;

The result of this is in the attached plot.

Since my plot contains many empty bins, I do not want to draw these, so as to have only bins with non-zero entries. Is there a way to do this?

The option “p” should, as stated in the THistPainter page," Draw current marker at each bin except empty bins". But I suppose that it does not consider the zero-entry bins as empty, since there is a a value of 0 and a non-null error? Any way around this?

Thanks for your help!
Kind regards,


Hi Thomas,

I’m having the same frustrating situation,
did you manage to figure this up ?



The data graphs in RooPlotd are based in TGraphs rather than TH1, so TH1 plot option do not work.

However, it is very easy to suppress the zero bins: do RooPlot::SetMinimum(1e-5). This will eliminate
all zero content entries, yet the ‘0’ on the Y axis is still drawn.


Thanks Wouter,

Isn’t there a more elegant and generic way to do that ?

I assume that this will not be good if I want to plot the histogram in log scale, isn’t it ?



I’m experiencing the same problem.

Did anyone figured out how to resolve this? In log scale the suggestion of Wouter doesn’t work.


Hi All,

Had the same problem. I fixed it like this (in PyROOT):

if h_data is the histogram with 0 bins

y_arr = h_data.GetY() for i in range(0,h_data.GetN()): if y_arr[i] == 0: h_data.SetPointError(i,0.,0.,0.,0.,)


Hi All,

I was wondering if there has been any development for this issue? All I want to do is set a range for the y axis which is in log scale. If I try set the range the empty bins cause issues.

I have tried to set limits and set range (The limit doesnt do anything… The range causes the log scale to break.) I guess the other option is to manually copy the contents of non-zero bins to a normal histogram and then do it that way? Seems a bit complicated for something simple no?

If anyone has a simpler solution I would greatly appreciate it :slight_smile: