comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Polar Plots?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Polar Plots? [message #12660] Fri, 07 August 1998 00:00
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Donald Stuart Finan (dfinan@ezinfo.ucs.indiana.edu) writes:

> Am I missing something or is there no easy way to do polar plots (with
> 0-360deg axis) in IDL? All I want to do is to make a phase plot with
> concentric rings for the radius. I've seen ppi.pro and am attempting to
> modify, but this is my first experience with polar plots, so it's slow
> going. Any tips?

It is not too hard. Here is a little program I coded up in 5 minutes
called PolarPlot. It uses a function (included) called CIRCLE
that I retrieved from my web page, and a function called ASPECT
that you will have to retrieve from my web page:

http://www.dfanning.com/programs/aspect.pro

I use ASPECT because I think polar plots should be displayed
with an aspect ratio of 1.

************************************************************ ****
FUNCTION Circle, xcenter, ycenter, radius
points = (2 * !PI / 99.0) * FINDGEN(100)
x = xcenter + radius * COS(points )
y = ycenter + radius * SIN(points )
RETURN, Transpose([[x],[y]])
END


PRO PolarPlot, 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 see it work with example data, just type: POLARPLOT.
(Be sure you download ASPECT first.)

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438, Toll Free Book Orders: 1-888-461-0155
Coyote's Guide to IDL Programming: http://www.dfanning.com/
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: sending external events to IDL application
Next Topic: Revision Control

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 08:41:24 PDT 2025

Total time taken to generate the page: 0.39758 seconds