ROOT
Version master
master
v6.34
v6.32
v6.30
v6.28
v6.26
v6.24
v6.22
v6.20
v6.18
v6.16
v6.14
v6.12
v6.10
v6.08
v6.06
v6.04
Reference Guide
►
ROOT
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Modules
Pages
Loading...
Searching...
No Matches
gr014_polar3.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphs
3
/// \notebook
4
/// \preview Create a polar graph using a TF1 and draw it with PI axis.
5
/// See the [TGraphPolar documentation](https://root.cern/doc/master/classTGraphPolar.html)
6
///
7
/// Since TGraphPolar is a TGraphErrors, it is painted with
8
/// [TGraphPainter](https://root.cern/doc/master/classTGraphPainter.html) options.
9
///
10
/// \macro_image
11
/// \macro_code
12
/// \author Olivier Couet
13
14
void
gr014_polar3
()
15
{
16
TCanvas
*
CPol
=
new
TCanvas
(
"CPol"
,
"TGraphPolar Examples"
,500,500);
17
18
Double_t
rmin
= 0;
19
Double_t
rmax
=
TMath::Pi
()*2;
20
Double_t
r
[1000];
21
Double_t
theta[1000];
22
23
TF1
*
fp1
=
new
TF1
(
"fplot"
,
"cos(x)"
,
rmin
,
rmax
);
24
for
(
Int_t
ipt
= 0;
ipt
< 1000;
ipt
++) {
25
r
[
ipt
] =
ipt
*(
rmax
-
rmin
)/1000+
rmin
;
26
theta[
ipt
] =
fp1
->Eval(
r
[
ipt
]);
27
}
28
29
TGraphPolar
*
grP1
=
new
TGraphPolar
(1000,
r
, theta);
30
grP1
->SetTitle(
""
);
31
grP1
->SetLineColor(2);
32
grP1
->Draw(
"AOL"
);
33
}
Int_t
int Int_t
Definition
RtypesCore.h:45
Double_t
double Double_t
Definition
RtypesCore.h:59
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Definition
TGWin32VirtualXProxy.cxx:168
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
TCanvas
The Canvas class.
Definition
TCanvas.h:23
TF1
1-Dim function class
Definition
TF1.h:233
TGraphPolar
To draw a polar graph.
Definition
TGraphPolar.h:23
TMath::Pi
constexpr Double_t Pi()
Definition
TMath.h:37
tutorials
visualisation
graphs
gr014_polar3.C
ROOT master - Reference Guide Generated on Mon Feb 24 2025 14:45:13 (GVA Time) using Doxygen 1.10.0