comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: Re: how to produce a color bar legend

Re: how to produce a color bar legend
type: item
description: Here is one possible way to display an image and produce a color bar legend. It was written for PV-WAVE. Ron ************************************************************ ************************* ; PROCEDURE for COLOR output from TVSCL with COLOR BAR ; PRO tvsclbar, array, white=white,txtcol=txtcol,txtsiz=txtsiz,nobar=nobar,min=min, max=max ON_ERROR, 2 ;Return to calling program if error array_size = SIZE(array) xdim = array_size(1) ydim = array_size(2) array_max = MAX(array,MIN=array_min) ;Determine data minimum and maximum values IF N_ELEMENTS(min) THEN array_min = min ;Override minimum if set set as an argument IF N_ELEMENTS(max) THEN array_max = max ;Override maximum if set set as an argument display = BYTSCL(array,MIN=array_min,MAX=array_max,TOP=!D.N_COLORS) barwidth = 16 barheight = 0.75 * ydim background_color = !P.BACKGROUND ; Current background color IF N_ELEMENTS(white) THEN BEGIN ; Replace values <= white with maximum color value IF NOT N_ELEMENTS(min) THEN array_min = MIN(array>white) ; Minimum value in matrix >= white display = BYTSCL(array>white,MIN=array_min,MAX=array_max,TOP=!D.N_COLORS) ; Rescale display(WHERE(array LE white)) = !D.N_COLORS ; Reset all entries <= white background_color = !D.N_COLORS ; Set the background color so it will be "white" ENDIF ; ; Adjust text color and size. Necessary when color matches background or text is wrong size. ; textcolor = !D.N_COLORS IF N_ELEMENTS(txtcol) THEN textcolor = BYTE(txtcol) textsize = 1.0 IF N_ELEMENTS(txtsiz) THEN textsize = txtsiz ; Change textsize if desired ; ; Erase the display window, set desired background color, and display the image ; ERASE, background_color ;erase window, setting appropriate background color TV,display ; ; If a color bar is desired (default) generate an array for the colors and draw it with ; intensity annotations and an outlining box ; IF NOT N_ELEMENTS(nobar) THEN BEGIN ; ; Create color bar. The color_scale is initially 1 pixel wide ; color_bar = MAKE_ARRAY(1,!D.N_COLORS,…
creator: behling
date: 1995-11-03T08:00:00-00:00