polar coordinate plots with NCAR graphics?

From: jprusa <prusaj_at_nyahnyahspammersnyahnyah>
Date: Tue, 28 Mar 2006 21:50:19 -0500

> Hi:
>
> I'm trying to plot contours using polar coordinates. This should be a
> straightforward adaptation of contour plots using xy Cartesians. The
> primary problem is that I'm unable to plot whole field, only 1st
> quadrant.
>
> The code I've written to do this plot is:
>
> ===========================================================
>
> nct=20 ! number of contours
> cmn=0.0 ! field minimum contour
> cmx=1.0 ! field maximum contour
> cnt=(cmx-cmn)/float(nct-1) ! contour interval
> xm=float(m)
> call cpsetr ('VPL - VIEWPORT LEFT' ,0.0)
> call cpsetr ('VPR - VIEWPORT RIGHT' ,1.0)
> call cpsetr ('VPB - VIEWPORT BOTTOM',0.0)
> call cpsetr ('VPT - VIEWPORT TOP' ,1.0)
>
> call cpsetr ('T2D - TENSION ON 2D SPLINES',0.)
> call cpseti ('LLP - LINE LABEL POSITIONING',3)
>
> call cpseti ('CLS - CONTOUR LEVEL SELECTION',nct)
> call cpsetr ('CMN - min',cmn)
> call cpsetr ('CMX - max',cmx)
> call cpsetr ('CIS - interval',cnt)
>
> call cpseti ('MAP - mapping',2)
> call cpsetr ('XC1 - minimum r' , 0.)
> call cpsetr ('XCM - maximum r' , xm)
> call cpsetr ('YC1 - minimum angle', 0.)
> call cpsetr ('YCN - maximum angle',360.)
>
> call cpsetr ('ORV - outofrange val',1.e12)
> call cpseti('SET - turn off set',0)
>
> call cprect (tt,m,m,n,rwrk,lrwk,iwrk,lrwk)
> call cpcldr (tt,rwrk,iwrk)
>
> call frame
>
> ===========================================================
>
>
> This frame is embedded between several other "standard" xy plot
> frames that
> work just fine (both contours only and contours with color). The key
> changes
> should be to set MAP=2 and values XC1 <= radius <= XCM and YC1<= polar
> angle <= YCM.
>
> This code "sort of" works. It does give a polar plot BUT ONLY THE 1ST
> QUADRANT,
> eg, from 0 <= polar angle <= 90 degrees. I want full plane and thought
> I had set it
> so with YCN=360.
>
> If I set YCN=90., then all the data is plotted in the region 0 to 90
> degrees. It is
> "squeezed" and distorted, but all there. With YCN=360., the result in
> the 1st
> quadrant is fine, ie, it draws the contours correctly and without
> distortion, but it is
> drawing only 1/4 of data field... Since the code plots whole array if
> YCN =90 or
> less degrees; and other xy plots show whole field no problem, I am
> confident
> this is not an issue with reading in data array to be contour plotted
> (the xy
> Cartesian plots are perfectly done).
>
> I've tried setting XC1=-xm but that gives bizarre result with contours
> folding over
> each other which is not correct. I've also tried using "call set" to
> redefine the plotting
> area, and alternately "call cpsetr ('WDL...") etc. I've only succeeded
> in making things
> worse.
>
> A second problem is that the plot DOES NOT SHOW the max (cmx=1.0) and
> min (cmn=0.)
> contours which would define the boundary circle. I've set it to draw
> nct=20 contours, but
> only the 18 in the interior are drawn. Why are min/max contours not
> being drawn?
>
> Any help would be greatly appreciated. It you can see it, a pdf of the
> polar contour
> plot is attached below. The correct result should be (approximately )
> symmetrical
> about lines x=0 and y=0 ( there is about a 7 degree rotation).
> The origin is located in the lower left corner, where 2 contours are
> "pinched" together a bit. The origin OUGHT to be in the MIDDLE of the
> plot.
>
> Best regards,
> Joe Prusa

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Tue Mar 28 2006 - 19:50:19 MST

This archive was generated by hypermail 2.2.0 : Thu Mar 30 2006 - 15:04:23 MST