ROOT
master
Reference Guide
Loading...
Searching...
No Matches
graphpolar3.C
Go to the documentation of this file.
1
/// \file
2
/// \ingroup tutorial_graphs
3
/// \notebook
4
/// Create and draw a polar graph with PI axis using a TF1.
5
///
6
/// \macro_image
7
/// \macro_code
8
///
9
/// \author Olivier Couet
10
11
void
graphpolar3()
12
{
13
TCanvas
*CPol =
new
TCanvas
(
"CPol"
,
"TGraphPolar Examples"
, 500, 500);
14
15
Double_t
rmin = 0;
16
Double_t
rmax =
TMath::Pi
() * 2;
17
Double_t
r
[1000];
18
Double_t
theta[1000];
19
20
TF1
fp1(
"fplot"
,
"cos(x)"
, rmin, rmax);
21
for
(
Int_t
ipt = 0; ipt < 1000; ipt++) {
22
r
[ipt] = ipt * (rmax - rmin) / 1000 + rmin;
23
theta[ipt] = fp1.Eval(
r
[ipt]);
24
}
25
26
auto
grP1 =
new
TGraphPolar
(1000,
r
, theta);
27
grP1->SetTitle(
""
);
28
grP1->SetLineColor(2);
29
grP1->Draw(
"AOL"
);
30
}
Int_t
int Int_t
Definition
RtypesCore.h:45
Double_t
double Double_t
Definition
RtypesCore.h:59
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
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
graphpolar3.C
ROOT master - Reference Guide Generated on Thu Dec 19 2024 09:47:24 (GVA Time) using Doxygen 1.9.8