Viewing contents of file '../idllib/ghrs/pro/arc_cplot.pro'
pro arc_cplot,w1,f1,w2,f2,init_plot=init_plot, plot_info=plot_scale
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;+
;
;*NAME:
; arc_cplot
;
;*CLASS: graphics
;
;*CATEGORY:
;
;*PURPOSE:
; Procedure to plot a comparison of two spectra and manipulate the plot
;
;*CALLING SEQUENCE:
; arc_cplot,w1,f1,w2,f2 [,init_plot=init_plot, plot_info=plot_scale]
;
;*PARAMETERS:
; w1 and f1 are the wavelength and flux vectors for the first spectrum
; w2 and f2 are the wavelength and flux vectors for the second spectrum
;
;*OPTIONAL KEYWORDS:
; init_plot - (logical) - 0 - does not initialize plot scale
; 1 - initializes plot scales (req. 1st the time).
; plot_info - (structure) - plot scaling information (see ARC.PRO)
;
;*RESTRICTIONS:
; Subroutine called by ARC
;*NOTES:
;
;*PROCEDURE:
;
;*MODIFICATION HISTORY:
; R Robinson/CSC Version 1
; 18-apr-1992 JKF/ACC Moved to GHRS DAF.
; 18-may-1992 JKF/ACC - fixed bug in call to YESNO.
;-
;-------------------------------------------------------------------------------
on_error,2
if n_params(0) lt 1 then begin
message,'Calling sequence: arc_cplot,w1,f1,w2,f2',/cont
message,'Optional keywords: [init_plot=init_plot, plot_info=plot_scale]
end
if keyword_set(init_plot) then begin
;
; set initial scaling
;
plot_scale.xmin_max = [min([w1,w2]), max([w1,w2])]
plot_scale.ymin_max = [min([f1,f2])>0, 1.05*max([f1,f2])]
if !d.name eq 'TEK' then begin
plot_scale.colors(0)=1
plot_scale.colors(1)=8
plot_scale.colors(2)=10
end else begin
plot_scale.colors(0)= !p.color
plot_scale.colors(1)= fix(!p.color* .75)
plot_scale.colors(2)= fix(!p.color* .50)
endelse
endif
;
loop:
plot,w1,f1,xrange=plot_scale.xmin_max, yrange=plot_scale.ymin_max, $
position=plot_scale.position, color=plot_scale.colors(0)
oplot,w2,f2,color=plot_scale.colors(1),linestyle=1
mplt=' '
read,'Rescale the plot? [Y]/N ',mplt
yesno,mplt
if mplt then begin
splt=' '
print,' F to reset to [F]ULL size
print,' E to [E]XPAND the plot scale
read,' Enter F or E? ',splt
splt=strmid(strtrim(strupcase(splt),2),0,1)
if splt ne 'E' then begin
;
; Reset to default FULL range
;
plot_scale.xmin_max = [min([w1,w2]), max([w1,w2])]
plot_scale.ymin_max = [min([f1,f2])>0, 1.05*max([f1,f2])]
end else begin
;
; Expand to user specified plot scale.
;
print,' USE CURSOR TO SELECT PLOT SCALE ' + $
'(LOWER LEFT AND UPPER RIGHT)'
xval=fltarr(2)
yval=fltarr(2)
print,' CURSOR 1: select min. lambda ' + $
'and min. flux (lower left)'
print,' CURSOR 2: select max. lambda ' + $
'and max. flux (upper right)'
if !d.name eq 'TEK' then device,gin_char=6
for i=0,1 do begin
flush=get_kbrd(0) ;flush out type ahead buffer
if !d.name eq 'TEK' then cursor,xd,yd $
else cursor,xd,yd,/down
xval(i)=xd
yval(i)=yd
oplot,[xd,xd],[!cymin,!cymax],color=plot_scale.colors(2)
oplot,[!cxmin,!cxmax],[yd,yd],color=plot_scale.colors(2)
wait,1
endfor
plot_scale.xmin_max = [min(xval),max(xval)]
plot_scale.ymin_max = [min(yval)>0, max(yval)]
endelse
goto,loop
endif
;
; Redisplay clean plot
;
;plot,w1,f1,xrange=plot_scale.xmin_max, yrange=plot_scale.ymin_max, $
; position=plot_scale.position, color=plot_scale.colors(0)
;oplot,w2,f2,color=plot_scale.colors(1),linestyle=1
return
end