Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
gr014_polar3.py File Reference

Detailed Description

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

See the TGraphPolar documentation

Since TGraphPolar is a TGraphErrors, it is painted with TGraphPainter options.

import math
import numpy as np
import ROOT
CPol = ROOT.TCanvas("CPol", "TGraphPolar Examples", 500, 500)
rmin = 0
rmax = math.pi * 2
r = np.array([])
theta = np.array([])
fp1 = ROOT.TF1("fplot", "cos(x)", rmin, rmax)
for ipt in range(1000):
r = np.append(r, ipt * (rmax - rmin) / 1000 + rmin)
theta = np.append(theta, fp1.Eval(r[ipt]))
grP1 = ROOT.TGraphPolar(1000, r, theta)
grP1.Draw("AOL")
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Author
Olivier Couet, Jamie Gooding

Definition in file gr014_polar3.py.