# Add global title to a root canvas

**URL:** <https://root-forum.cern.ch/t/add-global-title-to-a-root-canvas/51463>\
**Category:** Newbie\
**Created:** [September 5, 2022, 6:03pm UTC](https://root-forum.cern.ch/t/add-global-title-to-a-root-canvas/51463 "2022-09-05T18:03:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![thegame](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/t/e495f1/32.png) [@thegame](https://root-forum.cern.ch/u/thegame)\
**Post date:** [September 5, 2022, 6:03pm UTC](https://root-forum.cern.ch/t/add-global-title-to-a-root-canvas/51463/1 "2022-09-05T18:03:50Z")

</div>

Hi everyone, needless to say, I’m very new to ROOT.

I’m trying to plot a canvas with divide (3,2) with a global title/heading to the canvas. I haven’t found an appropriate solution to add the title to a canvas (NOT to the individual plots). Thus, would be of great help if you have any suggestions. Thanks.

---

<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:** [September 6, 2022, 4:47am UTC](https://root-forum.cern.ch/t/add-global-title-to-a-root-canvas/51463/2 "2022-09-06T04:47:14Z")

</div>

Try:

```auto
{
  TCanvas *c = new TCanvas("C","canvas",600,800);
  TLatex *lat = new TLatex(.4,.95,"canvas title");
  lat->Draw(); // drawn on canvas

  TH1F *h = new TH1F("h","histo",10,1,10);

  TPad *p1 = new TPad("p1","top",0,0.45,1,0.9); // xlow,yloy, xup,yup
  TPad *p2 = new TPad("p2","bottom",0,0,1,0.45);

  p1->Draw();
  p1->cd();
  h->DrawClone();

  c->cd(); // to draw p2 on c, not inside p1

  p2->Draw();
  p2->cd();
  h->Draw();

  return;
}

```

 ![C](https://root-forum.cern.ch/uploads/default/original/3X/0/a/0a39c0117449c9c395127975a94802e54b1ca76f.png)

Basically, do your own pads (instead of using TCanvas::Divide) leaving space on the canvas for the text that you want to draw on the canvas; in this example the pads only go up to 90% of the canvas height. There are other ways; for instance you could use divide but making some extra space inside the top pad (with `gPad->SetTopMargin(somevalue)`) and then drawing the text on that pad (around y=0.95 or so).

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [September 20, 2022, 4:47am UTC](https://root-forum.cern.ch/t/add-global-title-to-a-root-canvas/51463/3 "2022-09-20T04:47:55Z")

</div>

Closed on September 20, 2022, 4:47am UTC

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