Plotting LEGO with SURF

Hello all.
I seem to be running into an issue when I try to superpose my TH2D using LEGO and it’s corresponding fit using SURF. Specifically I think the z-axis is getting distorted (not sure how exactly to phrase it).

Efficiency2D.root (14.8 KB)

import ROOT
ROOT.gROOT.SetBatch(True)

f = ROOT.TFile("Efficiency2D.root", "READ")

c = ROOT.TCanvas()
f.Get("hER_clone").Draw("LEGO2")
c.Draw()
c.SaveAs("Efficiency.pdf")


c = ROOT.TCanvas()
f.Get("fit").Draw("SURF2")
c.Draw()
c.SaveAs("Fit.pdf")

c = ROOT.TCanvas()
f.Get("hER_clone").Draw("LEGO2")
f.Get("fit").Draw("SURF2 SAME")
c.Draw()
c.SaveAs("EfficiencyAndFit.pdf")

c = ROOT.TCanvas()
f.Get("fit").Draw("SURF2")
f.Get("hER_clone").Draw("LEGO2 SAME FB BB A")
c.Draw()
c.SaveAs("FitAndEfficiency.pdf")

I am attaching a simple .root file and a corresponding plotting script. As you can see the maximum of the z-value isn’t where it is supposed to be the fit should have a max of around 0.2 but in the EfficiencyAndFit.pdf case it maxes out at 1.0? Alternatively in the FitAndEfficiency.pdf case the efficiency which should hover around 0.2, now hovering at 0.05?
Apologies for the not-so-minimal reproducer.

Let me know for anything else.
Thanks.


Please read tips for efficient and successful posting and posting code

ROOT Version: 6.40.02
Platform: linuxx8664gcc
Compiler: g++ (GCC) 16.1.1 20260515 (Red Hat 16.1.1-2) std202002


Hi,

“SAME” draw option has limitations and does not work for “SURF” and “LEGO” plots. See:

As a workaround, you can try to use web display which works better.
Just add in the beginning ROOT.gROOT.SetWebDisplay("chrome")
You need to have chromium browser installed on your system.

Regards,
Sergey