Is TCanvas's title used for anything when writing files?

I’m using ROOT 6.08/06 on MacOSX. When I write a TCanvas out to a PostScript file (either single page or multipage), I notice that the page comes out with an “extra” top margin, compared to the left, right and bottom. Ah, ha! I thought, that must be where the TCanvas title string would be written.

So while printing, I tried using canv.SetTitle(“What this page is about”); statements before each page. I also tried instantiating the TCanvas with a title string (TCanvas canv(“c”,“Why am I making these plots?”);). Nothing. The PostScript pages still come out with a fat, and empty, top margin.

Is the canvas’s title string used for anything when writing out a file? Or is it strictly limited to being the interactive window title?

Can you provide a small script reproducing what you get ?

Hi, Olivier. Here’s a simple macro:

TH1* plot = new TH1D("plot","Demo plot",10,0,10);
TCanvas canv("c","This is the title of my canvas");
canv.Divide(2,2);
canv.cd(1); plot->Draw();
canv.cd(2); plot->Draw();
canv.Print("no-title.ps");

If I type these commands one by one at the ROOT prompt, the TCanvas comes up as a window, and the title string is up in the window frame.

However, the output file, no-title.ps, does not have the title string at the top of the page. It is the latter which I’m looking for. I expect there’s simply an option flag that I haven’t found in the documentation.

Hi Mike,

The title you give to the TCanvas is the title on the canvas window in the window manager. It does not appear in the graphics area and consequently not in the pdf nor ps file. It has alway been like that. If you want a global title in the graphics area you should proceed as in this example for instance: https://root.cern/doc/master/surfaces_8C.html

Olivier Couet writes:

The title you give to the TCanvas is the title on the canvas window in the
window manager. It does not appear in the graphics area and consequently not
in the pdf nor ps file. It has alway been like that.

Ah, okay. So TPaveText is the only way; thank you! I’ll add an
appropriate function to my ROOT macro suite.
– Mike

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