Declan Vogt (drv102@ohm.york.ac.uk) writes:
> Help! What I am trying to do is create an antenna pattern plot. This is
> normally presented as a polar plot with r indicating field strength in
> direction theta. I have used essentially the technique suggested by
> David Fanning in his tips, but I have run into a problem:
>
> I want my axes to be positive only. For example, I'd like the X axis to
> show values: 40 30 20 10 0 10 20 30 40, or not show values left of the Y
> axis.
You can simply format your axes labels any way you like.
Here is the tip on my web page re-written to give
positive axis values only. The Positive_Axis_Labels
function is a tick-formatting function called with
the [XY]Tickformat keywords on the AXIS command.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
------------------------------------------------------------ ---
FUNCTION Positive_Axis_Labels, axis, index, value
RETURN, String(ABS(value), Format='(I4)')
END ;----------------------------------------------------------
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, _Extra=extra
; 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, XTickFormat='Positive_Axis_Labels'
Axis, /YAxis, 0, 0, Color=2, YTickFormat='Positive_Axis_Labels'
; 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 ;----------------------------------------------------------
|