# Problem with TPaveText and Multiple Pads

**URL:** <https://root-forum.cern.ch/t/problem-with-tpavetext-and-multiple-pads/35696>\
**Category:** Newbie\
**Created:** [August 19, 2019, 3:37pm UTC](https://root-forum.cern.ch/t/problem-with-tpavetext-and-multiple-pads/35696 "2019-08-19T15:37:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![LCotrozzi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/9de0a6/32.png) [@LCotrozzi](https://root-forum.cern.ch/u/LCotrozzi)\
**Post date:** [August 19, 2019, 3:37pm UTC](https://root-forum.cern.ch/t/problem-with-tpavetext-and-multiple-pads/35696/1 "2019-08-19T15:37:34Z")

</div>

Hi all. I have an issue plotting histograms (TH1F) together with TPaveText in different pads of a single canvas. If I do TPaveText-\>Draw(), the plot is cleared and only the text is left. Instead, if I plot a histogram together with a TPaveText on a single-pad canvas, then the TPaveText works normally. I have tried to use Draw(“same”) - even if it is not needed for a single-pad canvas - but it did not fix the issue. I am attaching a small macro to show how I use TPaveText on a single pad (Histo\_TPave\_Canvas.C) and another one, for a canvas split into two pads (Histo\_TPave\_Subcanvas.C). In the latter, I have commented out the TPaveText-\>Draw() for the second pad, so what I see if I run the macro is just the text on the first pad and just the histogram on the second pad.

I am using ROOT 6.14/06 on Ubuntu 18.04.3 LTS.

Thank you in advance!

[Histo\_TPave\_Canvas.C](https://root-forum.cern.ch/uploads/short-url/rSrUMTIhzWBzivMPeFNnHF29JHZ.C) (684 Bytes) [Histo\_TPave\_Subcanvas.C](https://root-forum.cern.ch/uploads/short-url/zu8oKPldsTxAvnOp3DWcKbUwwsR.C) (776 Bytes)

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 19, 2019, 4:03pm UTC](https://root-forum.cern.ch/t/problem-with-tpavetext-and-multiple-pads/35696/2 "2019-08-19T16:03:28Z")

</div>

```auto
ptext->SetFillStyle(0);

```

---

<div class="post-metadata">

**Author:** ![LCotrozzi](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/l/9de0a6/32.png) [@LCotrozzi](https://root-forum.cern.ch/u/LCotrozzi)\
**Post date:** [August 19, 2019, 4:19pm UTC](https://root-forum.cern.ch/t/problem-with-tpavetext-and-multiple-pads/35696/3 "2019-08-19T16:19:01Z")

</div>

Thank you very much, it worked!

I also realized that if I save the plot with

```auto
canvas -> SaveAs("File.pdf")

```

then the PDF file created shows both the histogram and the TPaveText, as expected, even with

```auto
ptext -> SetFillStyle(4000);

```

Setting it to 0 totally fixed my problem for the canvas created by the macro.

Thanks again!

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [August 19, 2019, 5:14pm UTC](https://root-forum.cern.ch/t/problem-with-tpavetext-and-multiple-pads/35696/4 "2019-08-19T17:14:42Z")

</div>

[Fill styles 4000 to 4100 are for TPad only.](https://root.cern.ch/doc/master/classTAttFill.html#F2)
