# Builds a polar graph in a square Canvas. from ROOT import TGraphPolar, TCanvas, TMath from array import array c = TCanvas("myCanvas","myCanvas",600,600) rmin = 0. rmax = TMath.Pi()*6. npoints = 300 r = array('d',[0]*npoints) theta = array('d',[0]*npoints) for ipt in xrange(0,npoints): r[ipt] = ipt*(rmax-rmin)/npoints+rmin theta[ipt] = TMath.Sin(r[ipt]) grP1 = TGraphPolar(npoints,r,theta) grP1.SetTitle("A Fan") grP1.SetLineWidth(3) grP1.SetLineColor(2) grP1.DrawClone("L") raw_input("Press enter to exit.")