How to avoid drawing empty histogram bins?

Hi all,

If drawing a histogram with a line width >1, or if the frame line width is >1, ROOT seems to draw also empty histogram bins (thin red line close to the abscissa in attached plot).

Is it possible to tell ROOT not to draw those bins? In the case where the ordinate starts at a non-zero value (eg. log-plots) they are a problem, since empty histogram bins are drawn as non-empty.

If it is a bug, is anyone aware of a workaround that would allow me to use line widths >1?

Commands to reproduce the plot:

//gStyle->SetFrameLineWidth(2);
gStyle->SetOptLogy(true);
TH1F* h = new TH1F("h", "h", 9, 0., 9.);
h->Fill(4.5);
h->SetLineColor(kRed);
h->SetLineWidth(2);
h->Draw();

Thanks in advance.

Cheers,
Tore


With the default contour option, empty bins are always drawn.
Use a different option (eg bar)
h.SetFillColor(2)
h.Draw(“bar”)

Rene

Hi Rene,

Thanks for your reply. Your suggestion works fine; the empty bins are not drawn. However, I would like to use contoured histograms. I guess I will just use frame/line width=1.

Cheers,
Tore