Set title of histograms drawn with option same

Hi ROOT,

When I draw histograms with the “same” option the title of the resultant plot is the title of the first histogram to be drawn. In some cases i want this title to be different, I am aware I can change the title of the first histogram but then this effects the legend key for the histogram also when build with TCanvas::buildLegend.

At the moment to achieve this I draw the canvas without the title using gStyle->SetOptTitle(kFALSE) then putting a TPaveText box where the title should go. Is there a more elegant way?

Regards

There is several ways. Here is an other one:

root [0] TCanvas canvas("canvas");
root [1] frame = canvas.DrawFrame(-1., 0., 2., 2.);
root [2] frame->SetTitle("My Title");

Then you plot the histograms with the option SAME.

You can also use a THStack…

thanks got it working