Dear ROOT experts,
When I set gStyle.SetCanvasPreferGL(True), the x-title for the ratio pad becomes not visible anymore, i.e. when I want to set it `p_{T}^{miss}` , only p_{T} or only p^{miss} gets drawn. I thought that it has something to do with the `gStyle.SetPadBottomMargin(0.13)`, but if I increase this value, then the whole ratio pad gets increased and the x title has the same issue. Do you have any suggestions on what I could try?
Please note that when the gStyle.SetCanvasPreferGL(False), I do not face this issue, though then the uncertainty bands are not transparent anymore (even though SetFillColorAlpha(ROOT.kGray+1, 0.4) is used).
Thank you for your help!
@couet might be able to help here.
Can you show the code you are using and what you get? or better, a minimum working example that shows the issue? Without details it’s hard to tell.
Guessing, from what you say, that you are doing a TRatioPlot, I don’t see the problem, neither in C++ nor Python, e.g. (adapted from the TRatioPlot doc):
import ROOT as R
R.gStyle.SetCanvasPreferGL(1)
R.gStyle.SetOptStat(0)
c1 = R.TCanvas("c1", "fit residual simple")
h1 = R.TH1D("h1", "h1", 50, -5, 5)
h1.FillRandom("gaus", 2000)
h1.Fit("gaus", "0")
h1.GetXaxis().SetTitle("x")
rp1 = R.TRatioPlot(h1)
rp1.Draw()
rp1.GetLowerRefYaxis().SetTitle("ratio")
rp1.GetUpperRefXaxis().SetTitle("p_{T}^{miss}")
rp1.GetUpperRefYaxis().SetTitle("entries")
gives me:
1 Like
I actually found a fix, so it was because of this line here:
ratio_pad.set_margin(0.13, 0.05, 0.35, 0.03) , setting 0.35 to 0.42 solved the problem, i.e seems like ratio pad bottom margin was not large enough for my chosen title/label sizes + title offset. I will mark this as a solution, might be helpful to other beginners. Many thanks for your prompt responses!