pro tvcon, Image, x_arg, y_arg, _extra = _extra, $ sample = sample, xmargin=xmargin, ymargin=ymargin, $ fit_window = fit_window, resize = resize, scale = scale, $ xtick_get = xtick_get, ytick_get = ytick_get, xstyle = xstyle, ystyle = ystyle ;+ ; NAME: ; TVCON ; ; PURPOSE: ; Displays an image in the brightness representation surrounded with coordinate axes to fit ; current graphics device (TV + CONgrid). Similar to the standard routine ; IMAGE_CONT, but without contours. Various keyword parameters added. ; ; CATEGORY: ; General graphics. ; ; CALLING SEQUENCE: ; TVCON, Image [, X_arg, Y_arg] ; ; INPUTS: ; Image: Array to be displayed. This array may be of any type. ; ; OPTIONAL INPUT PARAMETERS: ; X_arg: Argument along X axis. If supplied, then Y_arg must be supplied also. ; The dimensions of X_arg, Y_arg must correspond to the dimensions of the Image. ; Usage of these arguments is the same as for the CONTOUR routine. ; ; Y_arg: Argument along Y axis. If supplied, then X_arg must be supplied also. The ; dimensions of X_arg, Y_arg must correspond to the dimensions of the Image. ; ; KEYWORD PARAMETERS: ; Scale: If set and equal to zero, then the array Image is displayed as is, without scaling ; of brigthness (TV). Otherwise (by default), scaling is performed (TVSCL). ; ; Resize: Scalar integer or floating-point number specifying the number of pixels ; to resize the Image when output to PostScript is performed. By default, ; the Image is not resized if its least dimension exceed 500, otherwise ; its dimensions are resized in such a way that the least dimension becomes 500. ; This enhances the quality of the image in the printout. ; ; If many images are sent to the PostScript file, then its size can become huge ; when all of them are resized in such a way. To prevent this, set Resize to a ; less value. ; ; Fit_window: If set and nonzero, then the plotting region fits displayable area similar to ; setting xmargin = [0,0] and ymargin = [0,0] ; ; Standard keywords: background charsize color noerase position subtitle title [xy]margin ; [xy]minor [xy]style [xy]thick [xy]tickformat [xy]ticklen [xy]tickname ; [xy]ticks [xy]tickv [xy]title ; ; OUTPUTS: ; None. ; ; COMMON BLOCKS: ; None. ; ; SIDE EFFECTS: ; The array is displayed on the current graphics device. ; ; RESTRICTIONS: ; If either of X_arg, Y_arg is supplied, then both of them must present. The dimensions of ; X_arg, Y_arg must correspond to the dimensions of the Image. ; ; The image always fits the displayable region of the graphics device, and the aspect ratio ; is not maintained. ; ; PROCEDURE: ; TV(SCL) + CONGRID are used. In case of PostScript device, pixels of the Image are ; scaled, instead of use the CONGRID routine. ; ; MODIFICATION HISTORY: ; ; ISTP SD RAS, 1999. ; Victor Grechnev (grechnev@iszf.irk.ru): Initially written. ; ; ISTP SD RAS, Jul, 2002. ; Natalia Meshalkina (nata@iszf.irk.ru): Help added. ; ; ISTP SD RAS, 2005, Jan. ; Victor Grechnev (grechnev@iszf.irk.ru): ; Modified to use the _EXTRA keyword parameter passing technique. ; ;- Sz=size(Image) if Sz[0] ne 2 then message, 'The argument must be 2-d array' if n_elements(xstyle) le 0 then xstyle=!x.style if n_elements(ystyle) le 0 then ystyle=!y.style if n_elements(xmargin) le 0 then xmargin=!x.margin if n_elements(ymargin) le 0 then ymargin=!y.margin if n_elements(scale) le 0 then scale=1 if keyword_set(fit_window) then begin xmar = [0,0] ymar = [0,0] endif else begin xmar = xmargin ymar = ymargin endelse Pmsave=!P.multi N=Sz[1] > Sz[2] > 20 arguments=1 if n_elements(x_arg) le 0 then begin x_arg=findgen(N)/(N-1)*(Sz[1]-1) arguments=0 endif if n_elements(y_arg) le 0 then y_arg=findgen(N)/(N-1)*(Sz(2)-1) plot, x_arg, y_arg, xst=5, yst=5, /nodata, xmargin=xmar, ymargin=ymar, _extra = _extra Pmsave1=!P.multi !P.multi=Pmsave int = 1-(keyword_set(sample)) SzN = Sz[1:2] if max(SzN/500.) lt 1 or n_elements(resize) gt 0 then begin if n_elements(resize) le 0 then resize = 500. if SzN[0] gt SzN[1] then SzN = SzN*float(resize[0])/SzN[0] else SzN = SzN*float(resize[0])/SzN[1] endif if scale then routine = 'tvscl' else routine = 'tv' if !d.name ne 'PS' then $ CALL_PROCEDURE, routine, $ congrid(Image, !d.x_size*(!x.window[1]-!x.window[0]), $ !d.y_size*(!y.window[1]-!y.window[0]), int=int, /minus),$ !d.x_size*!x.window[0],!d.y_size*!y.window[0] $ ELSE $ CALL_PROCEDURE, routine, $ congrid(Image, SzN[0], SzN[1], int = int), $ xsize=!d.x_size*(!x.window[1]-!x.window[0]), $ ysize=!d.y_size*(!y.window[1]-!y.window[0]), $, !d.x_size*!x.window[0],!d.y_size*!y.window[0],/dev CASE arguments OF 0: plot, x_arg, y_arg, xst = (1 or xstyle), yst = (1 or ystyle), $ /noerase, /nodata, xmargin = xmar, ymargin = ymar, _extra = _extra, $ xtick_get = xtick_get, ytick_get = ytick_get 1: contour, Image, x_arg, y_arg, xst=(1 or xstyle), yst=(1 or ystyle), $ /noerase, xmargin = xmar, ymargin = ymar, title=title, /nodata, _extra = _extra, $ xtick_get = xtick_get, ytick_get = ytick_get ENDCASE !P.multi=Pmsave1 end