[ROOT] Problem with ContZ

From: Jorge Romao (jorge.romao@ist.utl.pt)
Date: Fri Feb 21 2003 - 11:24:17 MET


Hi 

I am new to Root (just 3 days ago I downloaded the 3.04 version for my
Linux RedHat 7.3 machine). I am using it because (I am working in
theoretical HEP) I want to make some contour plots. I have however two
problems:

1) Draw("Cont4Z") works well but produces a PS file with (or without, I
do not know what this is) antialias. When seen in gv has a kind of grid
that does not print but it not very nice.

2) Draw("ContZ") does not have that (anti)alias problem but does not the
correct contours. As I probably am doing something wrong I am including
below in a very simple macro where you can see what I mean.

Thanks for the help

Jorge



{

//                   My Macro contour.C

  gROOT->Reset();
  gStyle->SetPalette(1);
  gStyle->SetOptStat(0);
  TGaxis::SetMaxDigits(2);
  gStyle->SetStripDecimals(kFALSE);
 
  MyC = new TCanvas("MyC","",1);
  MyC->SetFillStyle(4000);  
  MyC->Divide(2,2);

   Float_t x,y,z;
   Int_t nlines = 0;
   TH2F *h2 = new TH2F("h2","",51,-2.,2.,51,-2.,2.);

   h2->SetContour(6); 

for(Int_t i=0;i<51;i++)
{
  for(Int_t j=0;j<51;j++)
    {
      x=-2. + 4.*((float) i)/50.;
      y=-2. + 4.*((float) j)/50.;
      z=4.-(x*x +y*y);
      h2->Fill(x,y,z);
    }
} 

   gPad->SetRightMargin(0.15);
   gPad->SetLeftMargin(0.15);
   gPad->SetBottomMargin(0.18);

   TAxis *xaxis = h2->GetXaxis();
   TAxis *yaxis = h2->GetYaxis();
   TAxis *zaxis = h2->GetZaxis();

   xaxis->SetTitle("x");
   yaxis->SetTitle("y");

   MyC->cd(1); 
   h2->Draw("Cont4Z");
   
   MyC->cd(2);
   h2->Draw("Surf3Z");

   MyC->cd(3); 
   h2->Draw("ContZ");
   
   MyC->cd(4);
   h2->Draw("Surf2Z");

}





-- 
Address:

Instituto Superior Tecnico
Departamento de Fisica
Av. Rovisco Pais, 1
1049-001 Lisboa, Portugal

Tel.    +351 21 841 7778   (Office)         
Fax     +351 21 841 9143   (Dep. de Fisica) 
e-mail:  jorge.romao@ist.utl.pt (preferred)
         or 
         fromao@alfa.ist.utl.pt



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