Re: [ROOT] Displaying contours on a surface plot

From: Olivier Couet (Olivier.Couet@cern.ch)
Date: Fri Mar 19 2004 - 15:57:19 MET


> >  May be one way to implement it would be something like:
> > 
> >     h2->Draw("SURF4");
> >     h2->Draw("CONT1 SAME");
> > 
> 
> Yes that would be fine.

 Hi Andreas,

 This change is now in CVS. So you macro is now much simpler:

{
   gROOT->Reset();

   TH2F* h2 = new TH2F("h2", "h2", NBins, -d, d, NBins, -d, d);
   for (int bx = 1;  bx <= NBins; ++bx) {
     for (int by = 1;  by <= NBins; ++by) {
       double x = h2->GetXaxis()->GetBinCenter(bx);
       double y = h2->GetYaxis()->GetBinCenter(by);
       h2->SetBinContent(bx, by, exp(-x*x)*exp(-y*y));
     }
   }

   TCanvas *c1=new TCanvas("c1","c1",600,600);
   h2->Draw("SURF4");
   h2->Draw("CONT1 SAME");
}

 and lines are properly hidden ...

 Cheers,     Olivier

-- 
Org:    CERN - European Laboratory for Particle Physics.
Mail:   1211 Geneve 23 - Switzerland                     Mailbox: J25910      
E-Mail: Olivier.Couet@cern.ch                            Phone:   +41 22 7676522
WWW:    http://cern.ch/Olivier.Couet/                    Fax:     +41 22 7677155



This archive was generated by hypermail 2b29 : Sun Jan 02 2005 - 05:50:06 MET