Bold, smooth boundaries in legend seemingly at random when drawing THStack object

ROOT Version: 6.26/04
Platform: x86_64-centos7
Compiler: gcc8


Dear Root Experts,

I am using pyRoot to draw a THStack object consisting of a number of histograms. I then also draw the legend with style “F”. I am puzzled by the fact that sometimes the boxes denoting the fill colour in the legend are surrounded by a bold, rounded line, and sometimes they are surrounded by a sharp non-bold line. I initially thought this might have been because some histograms which compose the THStack objects are TH1F histograms, and some are TH1D histograms, and that there are different style settings for each. I tried turning each histogram into a TH1D histogram (see code snippet), but I still get some histograms sporadically deciding to have smooth bold boundaries.

          if hist.InheritsFrom("TH1F"):
            h1d = root.TH1D(hist.GetName(), hist.GetTitle(), hist.GetNbinsX(), hist.GetXaxis().GetXbins().GetArray())
            for iBin in range(1,h1d.GetNbinsX()+1):
              h1d.SetBinContent(iBin, hist.GetBinContent(iBin))
              h1d.SetBinError(iBin, hist.GetBinError(iBin))
            hist = h1d;

These are the smooth, bold boundaries I’m talking about

Screenshot from 2022-11-14 20-49-42

I don’t want the “JfakeY” entry to be bold here. I also tried printing out a bunch of gStyle options using the python debugger and they all seem to be the same when I loop over each histogram in the THStack object.

Any help would be appreciated!
Ben

That’s probably because you have a thicker line width (h->SetLineWidth(...)) for JfakeY; try using the same line width for all histos.

Can you post a small reproducer?

Nevermind, you are correct. Some histograms had the line width set to 2… I thought I checked this using gStyle->GetHistLineWidth(). Thanks!

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