Histogram title manipulating

Hello,

recently I had to tune some plots look and found problems with histograms title. Here are my problems:

  1. I execute following code

TCanvas * c = new TCanvas("c", "c", 800, 600); c->Divide(2,1); TH1I * h = new TH1I("h", "h;a;b", 100, 0, 100); h->Draw(); h->SetTitleOffset(1.2);
The last function is obviously moving the X-axis title, not the histogram title. How I can manipulate the title of the histogram position/offset?

  1. I execute following code

TCanvas * c = new TCanvas("c", "c", 800, 600); c->Divide(2,2); c->SetTitle("test"); // doesn't put canvas title // let's try with latex TLatex * l = new TLatex(); l->DrawLatex(0.1, 1.15, "Qwertyu"); // this also doesn't work // let's try with subpads c->cd(1); TH1I * h = new TH1I("h", "h;a;b", 100, 0, 100); h->Draw(); l->DrawLatex(0.1, 1.15, "Qwertyu"); // this works nicely
What I would expect is to set title of the Canvas on the top of it, but I see only change of the text on the window bar. I was also trying to use TPaveText and TLatex to set the title, but in each case trying to print on “c->cd()” pad doesn’t work, I can do this in subpad after plotting some histogram or so. So question is: how I can put general canvas title for group of plots, not only for single subpad.

Greetings,
Rafal

The best you can do is change the alignment via TStyle::SetTitleAlign()

See http://root.cern.ch/root/html/THistPainter.html#THistPainter:PaintTitle for more info.

I agree that one should be able to modify the title placement with a method in TH1.