function CENTER_STR_X,str,size=size ;+ ; NAME: ; CENTER_STR_X ; ; PURPOSE: ; Calculates the x device coordinate to use when printing a string ; centered on the current window. ; ; CATEGORY: ; text ; ; CALLING SEQUENCE: ; s = CENTER_STR_X(str [,size = size]) ; ; INPUTS: ; str = the character string to be centered on the current window ; ; KEYWORD PARAMETERS: ; size (input) = character size to use when centering the string ; (default is 1). ; ; MODIFICATION HISTORY: ; written by Pat Guimaraes, STX, Oct. 5, 1991 ;- ; Check if keyword size was passed and if not, use the default value ; if N_ELEMENTS(size) eq 0 then size = 1 ; ; Calculate the x device coordinate ; len = STRLEN(str) devlen = !d.x_ch_size * len * size x = FIX((!d.x_size - devlen)/2.0) RETURN, x END ;**************************************************************************** function CENTER_STR_Y,str,size=size ;+ ; NAME: ; CENTER_STR_X ; ; PURPOSE: ; Calculates the y device coordinate to use when printing a string ; centered on the current window ; ; CATEGORY: ; text ; ; CALLING SEQUENCE: ; a = CENTER_STR_Y(str [,size = size]) ; ; INPUTS: ; str = the character string to be centered on the current window ; ; OPTIONAL INPUT PARAMETERS: ; ; KEYWORD PARAMETERS: ; size (input) = character size to use when centering the string ; (default is 1). ; ; MODIFICATION HISTORY: ; written by Amara Graps 930816 ;- ; ; Check if keyword size was passed and if not, use the default value ; if N_ELEMENTS(size) EQ 0 then size = 1 ; ; Calculate the y device coordinate ; devheight = !d.y_ch_size * size y = FIX((!d.y_size - devheight)/2.0) RETURN, y END ;******************************************************************************************** pro WPLOTIT, pt, win, data ;+ ; NAME: ; WPLOTIT ; ; PURPOSE: ; This procedure plots or images a 1D or 2D array. ; ; CATEGORY: ; Wavelets ; ; CALLING SEQUENCE: ; WPLOTIT, pt, win, data ; ; INPUTS: ; pt = a plot title string ; win = window number to plot into ; =0 for Image, ; =1 for Signal/Data, ; =2 for Wavelet, ; =10 or 11 for stretched image, ; other number = just a window and no plotting ; data = data or image array ; ; OUTPUTS ; plotted data array in window number # ; ; MODIFICATION HISTORY: ; Written by: Amara Graps September 1995 ; copyright (c) Amara Graps 1995, 1996. ;- COMMON Wave_color, $ max_color, max_image, $ white, yellow, lavender, aqua, pink, green, red, orange, blue, $ lt_gray, med_green, brown, olive, purple, dk_gray, black TT = WSIGTYPE(data, olen, error) CASE TT OF 'I': BEGIN ;Image ;Load basic color table and set the Wave_color common variables WVLOADCT, 0 ;gray-scale color table END 'S': BEGIN ;Signal ;Load basic color table and set the Wave_color common variables WVLOADCT, 2 END ENDCASE ;Color of text strings IF !p.background EQ 0 THEN cl = 255 ELSE cl = 0 CASE win OF 0: BEGIN stitle = 'Image' WINDOW, win, TITLE = stitle ERASE TVSCL, data devx = CENTER_STR_X(pt) devy = !d.y_size - 20 XYOUTS, devx, devy, pt, /device, color = cl END 1: BEGIN stitle = 'Signal/Data' WINDOW, win, TITLE = stitle ;Plot, handling colors correctly. First, draw axes ;and title using default colors, then draw data points ;using the common variable colors PLOT, data ,/nodata, title=pt, color = cl OPLOT, data, color = green END 2: BEGIN stitle = 'Wavelet' WINDOW, win, XSIZE=225, YSIZE=150, TITLE = stitle PLOT, data ,/nodata, title = pt, color = cl OPLOT, data, color = blue END 10: BEGIN ;An image window stitle = '' WINDOW, win, TITLE = stitle ERASE med = MEDIAN(data) STRETCH, 0, FIX(med*2) TVSCL, data ;Place title in center-top of plot devx = CENTER_STR_X(pt) devy = !d.y_size - 20 XYOUTS, devx, devy, pt, /device, color = cl END 11: BEGIN ;Another image window stitle = '' WINDOW, win, TITLE = stitle ERASE med = MEDIAN(data) STRETCH, 0, FIX(med*2) TVSCL, data devx = CENTER_STR_X(pt) devy = !d.y_size - 20 XYOUTS, devx, devy, pt, /device, color = cl END ELSE: BEGIN ;More specialized plotting done elsewhere stitle = '' WINDOW, win, TITLE = stitle END ENDCASE END ;of procedure wplotit ;****************************************************************