Problem with TPaveText and Multiple Pads

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 (684 Bytes) Histo_TPave_Subcanvas.C (776 Bytes)

ptext->SetFillStyle(0);
1 Like

Thank you very much, it worked!

I also realized that if I save the plot with

canvas -> SaveAs("File.pdf")

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

ptext -> SetFillStyle(4000);

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

Thanks again!

Fill styles 4000 to 4100 are for TPad only.