Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
macro3.py
Go to the documentation of this file.
1# Builds a polar graph in a square Canvas.
2
3from ROOT import TGraphPolar, TCanvas, TMath
4from array import array
5
6c = TCanvas("myCanvas","myCanvas",600,600)
7rmin = 0.
8rmax = TMath.Pi()*6.
9npoints = 300
10r = array('d',[0]*npoints)
11theta = array('d',[0]*npoints)
12for ipt in xrange(0,npoints):
13 r[ipt] = ipt*(rmax-rmin)/npoints+rmin
14 theta[ipt] = TMath.Sin(r[ipt])
15
16grP1 = TGraphPolar(npoints,r,theta)
17grP1.SetTitle("A Fan")
18grP1.SetLineWidth(3)
19grP1.SetLineColor(2)
20grP1.DrawClone("L")
21raw_input("Press enter to exit.")
The Canvas class.
Definition TCanvas.h:23
To draw a polar graph.
Definition TGraphPolar.h:23
constexpr Double_t Pi()
Definition TMath.h:40
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599