Re: [ROOT] graphs aspect ratio

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Mar 08 2002 - 09:32:29 MET


Hi Marian,

Your question 1:
 - use TCanvas::Show()

Your question 2
See following example
{
   //method1. compute ymax to get a commensurate range
   // 1 pixel must correspond to the same range in x and y
   TCanvas c1("c1","c1",10,10,800,600);
   Float_t xmin = 0;
   Float_t xmax = 20;
   Float_t ymin = -2;
   Int_t npx = gPad->GetWw();
   Int_t npy = gPad->GetWh();
   Float_t ymax = ymin + (xmax-xmin)*npy/npx;
   TH2F h("h","",20,xmin,xmax,20,ymin,ymax);
   h.Draw();
   TArc a1(6,4,6);
   a1.Draw();
   
   //method2. set a square virtual canvas size in a non-square canvas 
   TCanvas c2("c2","c2",200,50,800,600);
   c2.SetCanvasSize(700,700);
   c2.DrawFrame(0,0,20,20);
   TArc a2(10,10,10);
   a2.Draw();
}

Note that once a pad has been created, you can force the aspect ratio to be
preserved when you grow/shrink the window with
  TPad::SetFixedAspectRatio

Rene Brun

Marian M. Liliac wrote:
> 
>    Part 1.1       Type: Plain Text (text/plain)
>               Encoding: quoted-printable
Hi ROOTers,

I would like, if possible, to get the answer for two questions:

1. Does anybody know how to convince a canvas to pop-up as a maximized window ? 
2. my pad is a colz type with equal dimensions (x, y). How can I preserve this
aspect ?
TH2F *h1= new TH2F("h1","Temperature profile",nodes,0,nodes,nodes,0,nodes);


Thank you and have a nice day.
Marian



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:45 MET