Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
macro3.C
Go to the documentation of this file.
1// Builds a polar graph in a square Canvas.
2
3void macro3(){
4 auto c = new TCanvas("myCanvas","myCanvas",600,600);
5 double rmin = 0.;
6 double rmax = TMath::Pi()*6.;
7 const int npoints = 1000;
8 double r[npoints];
9 double theta[npoints];
10 for (int ipt = 0; ipt < npoints; ipt++) {
11 theta[ipt] = ipt*(rmax-rmin)/npoints+rmin;
12 r[ipt] = TMath::Sin(theta[ipt]);
13 }
14 auto grP1 = new TGraphPolar(npoints,theta,r);
15 grP1->SetTitle("A Fan");
16 grP1->SetLineWidth(3);
17 grP1->SetLineColor(2);
18 grP1->Draw("L");
19 gPad->Update();
20 grP1->GetPolargram()->SetToRadian();
21}
ROOT::R::TRInterface & r
Definition Object.C:4
#define c(i)
Definition RSha256.hxx:101
#define gPad
The Canvas class.
Definition TCanvas.h:23
To draw a polar graph.
Definition TGraphPolar.h:23
void macro3()
Definition macro3.C:3
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
Float_t theta
Definition shapesAnim.C:10