ROOT
v6-36
Reference Guide
Loading...
Searching...
No Matches
gr014_polar3.py
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, Jamie Gooding
13
14
import
math
15
16
import
numpy
as
np
17
import
ROOT
18
19
CPol =
ROOT.TCanvas
(
"CPol"
,
"TGraphPolar Examples"
, 500, 500)
20
21
rmin = 0
22
rmax =
math.pi
* 2
23
r =
np.array
([])
24
theta =
np.array
([])
25
26
fp1 =
ROOT.TF1
(
"fplot"
,
"cos(x)"
, rmin, rmax)
27
for
ipt
in
range
(1000):
28
r =
np.append
(r, ipt * (rmax - rmin) / 1000 + rmin)
29
theta =
np.append
(theta,
fp1.Eval
(r[ipt]))
30
31
grP1 =
ROOT.TGraphPolar
(1000, r, theta)
32
grP1.SetTitle
(
""
)
33
grP1.SetLineColor
(2)
34
grP1.Draw
(
"AOL"
)
TRangeDynCast
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Definition
TCollection.h:358
ROOT::Detail::TRangeCast
Definition
TCollection.h:311
tutorials
visualisation
graphs
gr014_polar3.py
ROOT v6-36 - Reference Guide Generated on Thu Aug 21 2025 04:30:48 (GVA Time) using Doxygen 1.10.0