Viewing contents of file '../idllib/contrib/tappin/graffer/gr_as_ya.pro'
pro Gr_as_ya, data, xrange, yrange, range
;+
; GR_AS_YA
; Autoscale graffer data (Y-Axis, rectangular plot)
;
; Usage:
; gr_as_ya, data, range
;
; Arguments:
; data struct input The Graffer data structure (extracted
; from PDEFS)
; xrange float input The x- range of plot for functions th=f(r))
; yrange float input The theta- range for functions (r=f(th))
; range float in/out The range to use.
;
; History:
; Extracted from GR_AUTOSCALE: 16/12/96; SJT
;-
handle_value, data.xydata, xydata, /no_copy
maxrange = sqrt(max(xrange^2)+max(yrange^2))
case (data.type) of
-1: begin ; th = f(r)
if (xydata.range(0) ne xydata.range(1)) then begin
amin = xydata.range(0)
amax = xydata.range(1) < maxrange
endif else begin
amin = 0
amax = maxrange
endelse
x = findgen(data.ndata) * (amax-amin) $
/ float(data.ndata-1) + amin
fv = 0.
iexe = execute('fv = '+xydata.funct)
if (data.mode eq 2) then fv = fv*!Dtor
gr_pol_rect, x, fv, xx, yy
range(0) = range(0) < min(yy, max = mx)
range(1) = range(1) > mx
endif
-2: begin ; X = f(y)
if (xydata.range(0) ne xydata.range(1)) then begin
amin = xydata.range(0)
amax = xydata.range(1)
endif else begin
amin = 0.
if (data.mode eq 2) then amax = 360. $
else amax = 2.*!pi
endelse
y = findgen(data.ndata) * (amax-amin) $
/ float(data.ndata-1) + amin
fv = 0.
iexe = execute('fv = '+xydata.funct)
if (data.mode eq 2) then y = y*!Dtor
gr_pol_rect, fv, y, xx, yy
range(0) = range(0) < min(yy, max = mx)
range(1) = range(1) > mx
end
-3: begin ; x = f(t), y = f(t)
t = findgen(data.ndata) * $
(xydata.range(1)-xydata.range(0)) $
/ float(data.ndata-1) + xydata.range(0)
fr = 0.
ft = 0.
iexe = execute('fr = '+xydata.funct(0))
iexe = execute('ft = '+xydata.funct(1))
if (data.mode eq 2) then ft = ft*!Dtor
gr_pol_rect, fr, ft, x, y
range(0) = range(0) < min(y, max = fvmx)
range(1) = range(1) > fvmx
end
-4:
9:
Else: begin ; XY data, much easier (or it was)
gr_ang_pts, xydata, data.ndata, data.type, r, t
if (data.mode eq 2) then t = t*!Dtor
gr_pol_rect, r, t, x, y
range(0) = range(0) < min(y, max = mx)
range(1) = range(1) > mx
end
endcase
handle_value, data.xydata, xydata, /no_copy, /set
end