Suppressing y<0 in shaded bar histograms

[problem tested on 5.18 and 5.32]


I have just a ‘small’ presentation related question:

I compare to distributions, where one is drawn as bar histogram (e.g., h_1) with a shaded/colored filling and the other one (e.g., h_2) is just markers/error drawn on top of h_1.
The issue is, that I want to suppress for the filled bar histogram h_1 the region smaller than y=0 (some of the error bars of h_2 reach into y<0, so I cannot just limit the displayed range of the y-axis)

My stop-gap solution so far is, to create a third histogram h_3 as bar histogram with zero entries and white filling (1001), drawn ontop of h_1 (and drawing h_2 as last on top of both other histos). However, I have still problems keeping the axis ticks not being superimposed, i.e., h_3 overlays the axis ticks when drawn as “EBARSAME” and “EBARSAMEAXIS” does not work (it is simply not drawn)?!

Maybe somebody knows a better solution?

Cheers and thanks for any idea,

Your solution is good. Instead of creating a 3rd histo you can simply call gPad->DrawFrame(…).


but I just noticed that all my approaches to complicated for the thing I had in mind…
Drawing the histogram with “HIST” is all I needed in the end (skipping “BAR” and all the problems) :confused: