Avoid drawing histogram below y-axis minimum

Dear experts,
I am facing a very simple-looking but for yet unsolvable problem. I draw a histogram with set line style but no fill style and a limit y-range onto a canvas with logarithmic y-scale.
My problem is that bins whose content falls below the minimum of the y-axis is still displayed as a line that overlaps with the x-axis. This effect is highly undesirable since the actual x-axis and its ticks are not longer well visible.
I tried re-drawing the axis of the pad as well as re-drawing the histogram with the “axis” option – both without any visible impact.

Do you know of a way to circumvent this effect? Please find a piece of demonstrator code in pyROOT below.

hist = TH1F(“hist”, “hist”, 5, 0., 5.)
hist.SetBinContent(1, 0.)
hist.SetBinContent(2, 0.5)
hist.SetBinContent(3, 3.)
hist.SetBinContent(4, 6.)
hist.SetBinContent(5, 4.)

hist.SetMaximum(10.)
hist.SetMinimum(0.1)

hist.SetLineStyle(7)
hist.SetLineWidth(4)
hist.SetLineColor(kRed)
hist.SetFillStyle(0)

c = TCanvas(“c”, “c”, 800, 600)
c.cd()
c.SetLogy()
hist.Draw(“HIST”)

Your help is very much appreciated!
Thanks allot in advance.

Best regards
Oliver


ROOT Version: 6.04.18-x86_64-slc6-gcc49-opt
_Platform: _SL6
Compiler:


In that particular case I do not see any better answer than having the line width to the histogram equal to1.

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