ROOT logo

From $ROOTSYS/tutorials/graphics/earth.C

{
  //this tutorial illustrate the special contour options
  //    "AITOFF"     : Draw a contour via an AITOFF projection
  //    "MERCATOR"   : Draw a contour via an Mercator projection
  //    "SINUSOIDAL" : Draw a contour via an Sinusoidal projection
  //    "PARABOLIC"  : Draw a contour via an Parabolic projection
  // 
  //Author: Olivier Couet (from an original macro sent by Ernst-Jan Buis)
    
   gStyle->SetPalette(1);
   gStyle->SetOptTitle(1);
   gStyle->SetOptStat(0);

   TCanvas *c1 = new TCanvas("c1","earth_projections",700,700);
   c1->Divide(2,2);

   TH2F *ha = new TH2F("ha","Aitoff",    180, -180, 180, 179, -89.5, 89.5);
   TH2F *hm = new TH2F("hm","Mercator",  180, -180, 180, 161, -80.5, 80.5);
   TH2F *hs = new TH2F("hs","Sinusoidal",180, -180, 180, 181, -90.5, 90.5);
   TH2F *hp = new TH2F("hp","Parabolic", 180, -180, 180, 181, -90.5, 90.5);

   TString dat = gSystem->UnixPathName(gInterpreter->GetCurrentMacroName());
   dat.ReplaceAll("C","dat");
   dat.ReplaceAll("/./","/");

   ifstream in;
   in.open(dat.Data());
   Float_t x,y;
   while (1) {
     in >> x >> y;
     if (!in.good()) break;
     ha->Fill(x,y, 1);
     hm->Fill(x,y, 1);
     hs->Fill(x,y, 1);
     hp->Fill(x,y, 1);
   }
   in.close();

   c1->cd(1); ha->Draw("aitoff");
   c1->cd(2); hm->Draw("mercator");
   c1->cd(3); hs->Draw("sinusoidal");
   c1->cd(4); hp->Draw("parabolic");

   return c1;
}
 earth.C:1
 earth.C:2
 earth.C:3
 earth.C:4
 earth.C:5
 earth.C:6
 earth.C:7
 earth.C:8
 earth.C:9
 earth.C:10
 earth.C:11
 earth.C:12
 earth.C:13
 earth.C:14
 earth.C:15
 earth.C:16
 earth.C:17
 earth.C:18
 earth.C:19
 earth.C:20
 earth.C:21
 earth.C:22
 earth.C:23
 earth.C:24
 earth.C:25
 earth.C:26
 earth.C:27
 earth.C:28
 earth.C:29
 earth.C:30
 earth.C:31
 earth.C:32
 earth.C:33
 earth.C:34
 earth.C:35
 earth.C:36
 earth.C:37
 earth.C:38
 earth.C:39
 earth.C:40
 earth.C:41
 earth.C:42
 earth.C:43
 earth.C:44
 earth.C:45
 earth.C:46
thumb