ROOT
master
Reference Guide
Loading...
Searching...
No Matches
earth.C File Reference
Tutorials
»
Visualisation tutorials
»
Graphics tutorials
Detailed Description
This tutorial illustrates 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
"MOLLWEIDE" : Draw a contour via an Mollweide projection
TCanvas
*earth()
{
gStyle
->
SetOptTitle
(1);
gStyle
->
SetOptStat
(0);
TCanvas
*
c1
=
new
TCanvas
(
"c1"
,
"earth_projections"
, 700, 1000);
c1
->Divide(2, 3);
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);
TH2F
*hw =
new
TH2F
(
"hw"
,
"Mollweide"
, 180, -180, 180, 181, -90.5, 90.5);
TString
dat =
gROOT
->GetTutorialDir();
dat.
Append
(
"/visualisation/graphics/earth.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);
hw->
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"
);
c1
->cd(5);
hw->
Draw
(
"mollweide"
);
return
c1
;
}
Float_t
float Float_t
Definition
RtypesCore.h:57
gROOT
#define gROOT
Definition
TROOT.h:406
gStyle
R__EXTERN TStyle * gStyle
Definition
TStyle.h:436
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TH1::Draw
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition
TH1.cxx:3068
TH2F
2-D histogram with a float per channel (see TH1 documentation)
Definition
TH2.h:308
TH2::Fill
Int_t Fill(Double_t) override
Invalid Fill method.
Definition
TH2.cxx:393
TString
Basic string class.
Definition
TString.h:139
TString::Data
const char * Data() const
Definition
TString.h:376
TString::ReplaceAll
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition
TString.h:704
TString::Append
TString & Append(const char *cs)
Definition
TString.h:572
TStyle::SetOptTitle
void SetOptTitle(Int_t tit=1)
Definition
TStyle.h:334
TStyle::SetOptStat
void SetOptStat(Int_t stat=1)
The type of information printed in the histogram statistics box can be selected via the parameter mod...
Definition
TStyle.cxx:1640
y
Double_t y[n]
Definition
legend1.C:17
c1
return c1
Definition
legend1.C:41
x
Double_t x[n]
Definition
legend1.C:17
Author
Olivier Couet (from an original macro sent by Ernst-Jan Buis)
Definition in file
earth.C
.
tutorials
visualisation
graphics
earth.C
ROOT master - Reference Guide Generated on Wed Dec 18 2024 10:11:02 (GVA Time) using Doxygen 1.9.8