Logo ROOT   6.14/05
Reference Guide
graphpolar2.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
5 ///
6 /// \macro_image
7 /// \macro_code
8 ///
9 /// \author Olivier Couet
10 
11 void graphpolar2()
12 {
13  TCanvas * CPol = new TCanvas("CPol","TGraphPolar Example",500,500);
14 
15  Double_t theta[8];
16  Double_t radius[8];
17  Double_t etheta[8];
18  Double_t eradius[8];
19 
20  for (int i=0; i<8; i++) {
21  theta[i] = (i+1)*(TMath::Pi()/4.);
22  radius[i] = (i+1)*0.05;
23  etheta[i] = TMath::Pi()/8.;
24  eradius[i] = 0.05;
25  }
26 
27  TGraphPolar * grP1 = new TGraphPolar(8, theta, radius, etheta, eradius);
28  grP1->SetTitle("");
29 
30  grP1->SetMarkerStyle(20);
31  grP1->SetMarkerSize(2.);
32  grP1->SetMarkerColor(4);
33  grP1->SetLineColor(2);
34  grP1->SetLineWidth(3);
35  grP1->Draw("PE");
36 
37  CPol->Update();
38  grP1->GetPolargram()->SetToRadian();
39 }
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
Definition: TAttLine.h:43
void SetToRadian()
The Polar circle is labelled using radian.
virtual void SetTitle(const char *title="")
Set graph title.
Definition: TGraph.cxx:2216
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
Definition: TAttMarker.h:38
TGraphPolargram * GetPolargram()
Definition: TGraphPolar.h:39
constexpr Double_t Pi()
Definition: TMath.h:38
virtual void SetLineColor(Color_t lcolor)
Set the line color.
Definition: TAttLine.h:40
To draw a polar graph.
Definition: TGraphPolar.h:22
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
Definition: TAttMarker.h:40
virtual void SetMarkerSize(Size_t msize=1)
Set the marker size.
Definition: TAttMarker.h:41
The Canvas class.
Definition: TCanvas.h:31
double Double_t
Definition: RtypesCore.h:55
void Draw(Option_t *options="")
Draw TGraphPolar.
virtual void Update()
Update canvas pad buffers.
Definition: TCanvas.cxx:2248