Stop root plotting curves below the x-axis as flat lines

See the attached figure. Notice that the y-axis starts at about 10. You can see that the primitives are plotted normally above about y=10, but where the primitive is below y=10 a flat line is plotted near the x-axis instead of nothing being plotted.

How can I fix this figure so that ROOT doesn’t plot the parts of the primitives that are below the x-axis.

I’ve tried to redraw the axis in a number of different ways but it didn’t change anything. Even if I could redraw the axis it wouldn’t solve the problem as the flat lines are not quite on the axis and so would still be visible.

Kevin Maguire
PaperPlots_LNIP_KK.pdf (57.1 KB)

Can you tell a bit more about the kind of plot you are doing ? is it TH1s ? graphs ? do you have a small example reproducing the problem ? which root version are you using ?

Hi Olivier,

I assumed this was a more general problem with primitives but it appears to be specific to my use case as I can’t reproduce it in a simple way.

Find attached a simplified script that makes my plot from a .root file which is also attached. The output of this script ‘temp.pdf’ is also attached.

The .root file contains a canvas made in ROOT 5.34.18. It contains loads of TH1Ds with millions of entries all plotted together. These are the primitives I was refering to. I open the canvas, take the TH1Ds I want and change their axis ranges then plot them to a new canvas. When the TH1Ds are plotted on the new canvas, flat lines are printed near the x-axis where the TH1Ds are zero and where nothing should be printed. I ran the attached script with both ROOT 5.34.18 and ROOT 6.07.07

Kevin (1007 Bytes)
temp.pdf (19.7 KB)
temp.root (102 KB)

Draw the histograms using option “L”

This works, thanks. I see that these lines were being drawn due to the C option.