Remove horizontal line in canvas

ROOT Version: 6.20/06
Built for linuxx8664gcc on Jun 10 2020, 06:10:57
From tags/v6-20-06@v6-20-0

ROOT Version: 6.22/09
Built for macosxarm64 on May 16 2021, 22:36:00
From heads/v6-22-00-patches@v6-22-08-24-gdd3f79d017

Hi! Is it possible somehow to get rid of the automatically drawn line at y=0 that appears when doing for example

void horizontalLine() {
auto canvas = new TCanvas();
auto axis_hist = new TH1F("", “;x;y”, 1, 0, 1);
axis_hist->SetAxisRange(-2, 2, “Y”);


Thanks a lot,

PS: I saw this is discussed here, but not sure how these things relate under the hood.

That line is actually the histogram; since all the bins are empty (zero), the line is flat on that y value. You can “hide” it for instance with


As the bins are empty, no markers are drawn.

omg that should have been obvious to me, thanks a lot :smiley:

mv to noob section pls ^^

If your goal is to draw an empty frame with axis, you can use DrawFrame as explained here: ROOT: TPad Class Reference

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