Creating a Polar Plot
QUESTION: Donald Stuart Finan of Indiana University wrote in the IDL newsgroup recently:
Am I missing something or is there no easy way to do polar plots (with 0-360 deg axes) in IDL? All I want to do is to make a phase plot with concentric rings for the radius. This is my first experience with polar plots, so it's slow going. Any tips?
![]()
ANSWER: I wrote a little example program, named PolarPlotCenter, for Donald. For the concentric rings I used a program named Circle, which I downloaded from this web page. I also used a program from this web page named Aspect that returns a plot position in the display window of a specified aspect ratio. In this case I want polar plots to have an aspect ratio of 1 in the display window.
The PolarPlotCenter program is a wrapper for the Plot command and actually uses the Plot command with the Polar keyword set to create the polar coordinate space. The normal plot axes are supressed and the polar axes are drawn through the center of the polar plot with the Axis command. The code for the program looks like this:
PRO PolarPlotCenter, radius, angle ; Fake data if needed. IF N_Params() EQ 0 THEN BEGIN angle = ((Randomu(seed, 360)*360) - 180) * !DtoR radius = Randomu(seed, 360) * 100 ENDIF ; Load plot colors. TVLCT, [100, 255, 0], [100, 255, 255], [100, 0, 0], 1 Device, Decomposed=0 ; Establish plot coordinates. Plot, radius, angle, /Polar, XStyle=5, YStyle=5, $ /NoData, Background=1, Position=Aspect(1.0) ; Draw axis through center. Axis, /XAxis, 0, 0, Color=2 Axis, /YAxis, 0, 0, Color=2 ; Plot data. OPlot, radius, angle, PSym=2, /Polar, Color=3 ; Draw 25 and 75 percent circles. dataMax = Max(radius) percent25 = Circle(0, 0, 0.25*dataMax) percent75 = Circle(0, 0, 0.75*dataMax) PlotS, percent25, Color=2 PlotS, percent75, Color=2 END
To run the program, first download the three programs listed above and type this:
IDL> PolarPlotCenter
You see the results of the program in the illustration below.
![]()
Here is an example of the PolarPlotCenter program above called with the default data set. Concentric circles represent 25% and 75% of the maximun data value. Axes are drawn through the center of the plot.
![]()
Last Updated 9 September 1998

