TH1 remove vertical lines

Dear ROOT experts,

I am trying to produce a simple histogram without any vertical lines, i.e. only horizontal lines covering the full bin width and including error bars. My current plotting macro has the following structure:

void PlotTest(){ 
  SetAtlasStyle();
  #ifdef __CINT__
    gROOT->LoadMacro("AtlasLabels.C");
    gROOT->LoadMacro("AtlasUtils.C");
    gROOT->LoadMacro("AtlasStyle.C")
  #endif


  gStyle->SetPalette(kVisibleSpectrum);
  gStyle->SetHatchesLineWidth(2);
  gStyle->SetHatchesSpacing(1);
  hist->SetMarkerSize(0.0);
  hist->SetLineColor(1);
  hist->SetLineStyle(1);

  hist->Draw("E HIST");

  c.Print();
 
  return;

}

When I use the E HIST it produces the following https://ibb.co/XzY22gM and if use E HIST ][ it just prints points instead of lines: https://ibb.co/cvN0SgP. How can I fix it in order for it to have only horizontal lines like shown here: https://ibb.co/bPw4Dfj

Thanks in advance!

  h2->Draw("E");

Thank you for your answer, but this also produced the same plots with just the points…

OK, so let’s wait for @couet, he’s our graphics expert

1 Like

can we have access to your histogram “hist” ?

Hi @couet,

I just set up a minimal example here https://cernbox.cern.ch/index.php/s/SvyvslQ8hdhAxXk which you can just launch with root PlotTest.C

The atlas style set this horizontal error to 0.

  SetErrorX(0.0001);   // get rid of X error bars (as recommended in ATLAS figure guidelines)

try:

 [...]
  gROOT->SetStyle("ATLAS");
 atlasStyle->SetErrorX(0.5); // <<< change the X error

But if you do that you will not follow the recommended in ATLAS figure guidelines.

1 Like

Thanks! That solved my problem :slight_smile:

But, as I said, you do not follow the Atlas guidelines if you do that …

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