Logo ROOT  
Reference Guide
graphpolar3.C File Reference

Detailed Description

View in nbviewer Open in SWAN Create and draw a polar graph with PI axis using a TF1.

void graphpolar3()
{
TCanvas * CPol = new TCanvas("CPol","TGraphPolar Examples",500,500);
Double_t rmin=0;
Double_t rmax=TMath::Pi()*2;
Double_t r[1000];
Double_t theta[1000];
TF1 * fp1 = new TF1("fplot","cos(x)",rmin,rmax);
for (Int_t ipt = 0; ipt < 1000; ipt++) {
r[ipt] = ipt*(rmax-rmin)/1000+rmin;
theta[ipt] = fp1->Eval(r[ipt]);
}
TGraphPolar * grP1 = new TGraphPolar(1000,r,theta);
grP1->SetTitle("");
grP1->SetLineColor(2);
grP1->Draw("AOL");
}
Author
Olivier Couet

Definition in file graphpolar3.C.

TGraph::SetTitle
virtual void SetTitle(const char *title="")
Change (i.e.
Definition: TGraph.cxx:2324
r
ROOT::R::TRInterface & r
Definition: Object.C:4
Int_t
int Int_t
Definition: RtypesCore.h:45
TGraphPolar
Definition: TGraphPolar.h:23
TMath::Pi
constexpr Double_t Pi()
Definition: TMath.h:43
Double_t
double Double_t
Definition: RtypesCore.h:59
TCanvas
Definition: TCanvas.h:23
TF1::Eval
virtual Double_t Eval(Double_t x, Double_t y=0, Double_t z=0, Double_t t=0) const
Evaluate this function.
Definition: TF1.cxx:1450
TGraphPolar::Draw
void Draw(Option_t *options="")
Draw TGraphPolar.
Definition: TGraphPolar.cxx:100
TF1
1-Dim function class
Definition: TF1.h:212