Re: [ROOT] TPaveText

From: Rene Brun (Rene.Brun@cern.ch)
Date: Tue Jun 27 2000 - 14:46:11 MEST


Hi Christian,
When you create a TPaveText, you can choose in which coordinate system
you draw (current pad coordinates or NDC).
In your case, you want to give NDC coordinates. This should be specified
in the optional argument.
Replace the statement:
   TPaveText pt1(0.7,0.8,0.9,0.9);
by
   TPaveText pt1(0.7,0.8,0.9,0.9,"brNDC");

TPaveText derives from TPave. The options are explained TPave:

  option = "T" Top frame
  option = "B" Bottom frame
  option = "R" Right frame
  option = "L" Left frame
  option = "NDC" x1,y1,x2,y2 are given in NDC
  option = "ARC" corners are rounded

Rene Brun

Christian Haeberli wrote:
> 
> Dear ROOTers
> 
> I put four TGraphs in a TH2 and fitted them. Now I'd like to label the
> four curves. I tried it with TPaveText, but the problem is, that in my
> case TPavetext.Draw() works in an empty canvas only. Where is the
> mistake? You can see my code below.
> 
> Thank you
> 
> Christian
> 
> --
> 
> c1 = new TCanvas("c1","Resolution",200,10,700,500);
> 
> c1->SetFillColor(42);
> c1->SetGrid();
> c1->GetFrame()->SetFillColor(21);
> c1->GetFrame()->SetBorderSize(12);
> 
> TH2F *hr = new TH2F("hr","Resolution of the Strip Modules for
> electrons",40,5,60,40,4,13);
> hr->SetXTitle("Lead Thickness [mm]");
> hr->SetYTitle("Resolution (RMS) [mm]");
> hr->Draw();
> 
> TGraph *gr[4];
> 
> for (i=0;i<4;i++) {
>   gr[i] = new TGraph(n,lead,resol[i]);
>   gr[i]->SetTitle("Resolution");
>   gr[i]->SetMarkerColor(i+1);
>   gr[i]->SetMarkerStyle(21+i);
>   gr[i]->Draw("P");
>   gr[i]->Fit("pol3");
> }
> 
> TPaveText pt1(0.7,0.8,0.9,0.9);
> pt1.AddText("1 GeV");
> pt1.Draw();
> 
> --
> ___________________________________________________________________
> Christian Haeberli                       christian.haeberli@cern.ch
> University of Bern
> Laboratory for High Energy Physics       Phone : ++ 41 31 631 4069
> Sidlerstr. 5                             Mobile: ++ 41 76 316 6159
> CH-3012 BERN                             Fax   : ++ 41 31 631 4487



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:29 MET