pro wimage,a,xrange=xrange,yrange=yrange,aspect=aspect,$ title=title,xtitle=xtitle,ytitle=ytitle,noframe=noframe ;+ ; ROUTINE WIMAGE ; ; USEAGE: WIMAGE,a ; ; WIMAGE,a,title=title,xtitle=xtitle,ytitle=ytitle,$ ; xrange=xrange,yrange=yrange,$ ; noframe=noframe,aspect ; ; PURPOSE: Display an image with provisions for ; ; 1. plot title ; 2. annotated x and y axis ; 3. simplified OPLOT capability ; ; INPUT a image quantity ; ; Optional keyword input: ; ; title plot title ; ; xtitle x axis title ; ; ytitle y axis title ; ; xrange array spanning entire x axis range. ; NOTE: WIMAGE only uses min(XRANGE) and max(XRANGE). ; ; yrange array spanning entire y axis range. ; NOTE: WIMAGE only uses min(YRANGE) and max(YRANGE). ; ; ; aspect the x over y aspect ratio of the output image ; if not set aspect is set to (size_x/size_y) of the ; input image. ; ; noframe if set do not draw axis box around image ; ; ; ; PROCEDURE WIMAGE first determins the size of the plot data window ; with a dummy call to PLOT. When the output device is ; "X", CONGRID is used to scale the image to the size of ; the available data window. Otherwise, if the output ; device is Postscript, scaleable pixels are used in the ; call to TV. PLOT draws the x and y axis and titles. ; ; AUTHOR: Paul Ricchiazzi oct92 ; Earth Space Research Group, UCSB ; ; Amara Graps, January 1995 ; Bay Area Environmental Research Institute/NASA-Ames ; Adapted for WaveLab 0.6 ;- ;Color of text strings IF !p.background EQ 0 THEN cl = 255 ELSE cl = 0 sz=SIZE(a) nx=sz(1) ny=sz(2) nxm=nx-1 nym=ny-1 PLOT, [0,1],[0,1],/nodata,xstyle=4,ystyle=4 px=!x.window*!d.x_vsize py=!y.window*!d.y_vsize xsize=px(1)-px(0) ysize=py(1)-py(0) IF KEYWORD_SET(aspect) EQ 0 then aspect=FLOAT(nx)/ny IF xsize GT ysize*aspect THEN xsize=ysize*aspect ELSE ysize=xsize/aspect px(1)=px(0)+xsize py(1)=py(0)+ysize ; ; max_color=!d.n_colors-1 ; IF KEYWORD_SET(title) EQ 0 THEN title='' ;Color Range amax=FLOAT(max(a)) amin=FLOAT(min(a)) range=[amin,amax] ; ; aa=(max_color-1)*((FLOAT(a)-range(0))/(range(1)-range(0)) > 0. < 1.) ; IF !d.name eq 'X' OR !d.name eq 'MAC' THEN BEGIN TV,congrid(aa,xsize,ysize),px(0),py(0) pos=[px(0),py(0),px(1),py(1)] ENDIF ELSE BEGIN pos=[px(0),py(0),px(1),py(1)] TV,aa,px(0),py(0),xsize=xsize,ysize=ysize,/device ENDELSE ; IF (KEYWORD_SET(xtitle) EQ 0) THEN xtitle='' IF (KEYWORD_SET(ytitle) EQ 0) THEN ytitle='' IF (KEYWORD_SET(xrange) EQ 0) THEN $ xrng=[0,nxm] ELSE xrng=[MIN(xrange), MAX(xrange)] IF (KEYWORD_SET(yrange) EQ 0) THEN $ yrng=[0,nym] ELSE yrng=[min(yrange), MAX(yrange)] ;want min_y on bottom, max_y on top ;yrng=[0,nym] ELSE yrng=[max(yrange), MIN(yrange)] ;want min_y on top, max_y on bottom IF KEYWORD_SET(noframe) THEN BEGIN PLOT,[0,0],[0,0],xstyle=5,ystyle=5,title=title,xtitle=xtitle,ytitle=ytitle, $ xrange=xrng,yrange=yrng,position=pos,/noerase,/device,/nodata ENDIF ELSE BEGIN PLOT,[0,0],[0,0],xstyle=1,ystyle=1,title=title,xtitle=xtitle,ytitle=ytitle, $ xrange=xrng,yrange=yrng,position=pos,/noerase,/device,/nodata, color = cl ENDELSE ; END