# Title on x axis not visible when SetCanvasPreferGL(True)

**URL:** <https://root-forum.cern.ch/t/title-on-x-axis-not-visible-when-setcanvasprefergl-true/64731>\
**Category:** Newbie\
**Created:** [March 3, 2026, 2:40pm UTC](https://root-forum.cern.ch/t/title-on-x-axis-not-visible-when-setcanvasprefergl-true/64731 "2026-03-03T14:40:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![beg1nner](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@beg1nner](https://root-forum.cern.ch/u/beg1nner)\
**Post date:** [March 3, 2026, 2:40pm UTC](https://root-forum.cern.ch/t/title-on-x-axis-not-visible-when-setcanvasprefergl-true/64731/1 "2026-03-03T14:40:47Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![StephanH](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/s/c68b51/32.png) [@StephanH](https://root-forum.cern.ch/u/StephanH)\
**Post date:** [March 3, 2026, 2:45pm UTC](https://root-forum.cern.ch/t/title-on-x-axis-not-visible-when-setcanvasprefergl-true/64731/2 "2026-03-03T14:45:38Z")

</div>

@couet might be able to help here.

---

<div class="post-metadata">

**Author:** ![dastudillo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/dastudillo/32/17280_2.png) [@dastudillo](https://root-forum.cern.ch/u/dastudillo)\
**Post date:** [March 3, 2026, 3:29pm UTC](https://root-forum.cern.ch/t/title-on-x-axis-not-visible-when-setcanvasprefergl-true/64731/3 "2026-03-03T15:29:39Z")

</div>

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](https://root.cern/doc/master/classTRatioPlot.html)):

```auto
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:

 ![c1](https://root-forum.cern.ch/uploads/default/original/3X/5/b/5b86340aa6fb8686ca160c0136833d9d760e1b9f.png)

---

<div class="post-metadata">

**Author:** ![beg1nner](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/b/d26b3c/32.png) [@beg1nner](https://root-forum.cern.ch/u/beg1nner)\
**Post date:** [March 3, 2026, 5:46pm UTC](https://root-forum.cern.ch/t/title-on-x-axis-not-visible-when-setcanvasprefergl-true/64731/4 "2026-03-03T17:46:08Z")

</div>

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!
