Re: [ROOT] Changing placement of histogram title

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jul 23 2003 - 21:57:22 MEST


Hi Mark,

See your script modified. Look at the comment

Rene Brun

{
TProfile *fq = hprof;
TCanvas c1;
c1->Range(0,0,1,1);
c1->SetLogy();
c1->cd();
TPad *c1_1 = new TPad("c1_1", 
"c1_1",0.00851789,0.0126904,0.996593,0.992386);
c1_1->Draw();
c1_1->cd();
c1_1->SetLogy();
c1->cd();
TPad *c1_2 = new TPad("c1_2", 
"c1_2",0.627586,0.483204,0.960345,0.813953);
c1_2->Draw();
c1_2->cd();

c1_1->cd();
pfq->DrawCopy("hist");
c1_2->cd();
fq.DrawCopy("hist");
c1_2->Update(); //force painting pad to generate the title object

TPaveText *ttt = (TPaveText*)c1_2->FindObject("title");
ttt->SetX2NDC(0.7);
ttt->SetY1NDC(0.91);
c1_2->Modified();
}

On Wed, 
23 Jul 2003, Mark 
Horner wrote:

> Hi Rooters,
> 
> I am making a Canvas with two Pads - the one is an inset:
> TCanvas c1;
> c1->Range(0,0,1,1);
> c1->SetLogy();
> c1->cd();
> TPad *c1_1 = new TPad("c1_1", "c1_1",0.00851789,0.0126904,0.996593,0.992386);
> c1_1->Draw();
> c1_1->cd();
> c1_1->Range(-1.25,-4.28931,11.25,0.508575);
> c1_1->SetLogy();
> TPad *c1_2 = new TPad("c1_2", "c1_2",0.627586,0.483204,0.960345,0.813953);
> c1_2->Draw();
> c1_2->cd();
> c1_2->Range(-1.25,-0.7875,11.25,7.0875);
> 
> c1_1->cd();
> pfq->DrawCopy("hist");
> c1_2->cd();
> fq.DrawCopy("hist");
> 
> I draw a different histogram in each pad. This works perfectly. But the
> inset title is too small to read. I want to make it bigger but I cannot
> retrieve a pointer to the "title" for it. I try to get it with
> 
> TPaveText *ttt = (TPaveText*)c1_2->FindObject("title");
> 
> but this returns 0. I have tried using gPad but this doesn't work either.
> The SetTitleSize methods only affect the axis titles so how can I change
> the size of the histogram title in the smaller pad only?
> 
> Thanks,
> 
> Mark Horner
> 
> Physics Department
> University of Cape Town
> Rondebosch
> 7700
> South Africa
> 
> Phone: +27 21 650 3366 (office)
> Phone: +27 83 564 6272 (cellular)
> Fax:   +27 21 650 3342
> 
> Homepage:
> http://hep.phy.uct.ac.za/~horner
> 
> Co-author:
> http://savannah.gnu.org/projects/fhsst
> 
> "It went well. There are no problems, and, as a bonus, it showed that I
> have a brain!"
> - Stormers and Springbok backrower CORNE KRIGE speaking after undergoing a
> precautionary brain scan after a clash of heads during a Super 12 match.
> 



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET