Changeset 133 for trunk/SRC/Colors/colorbar.pro
- Timestamp:
- 07/07/06 11:57:27 (18 years ago)
- Location:
- trunk/SRC/Colors
- Files:
-
- 1 added
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Colors/colorbar.pro
r132 r133 1 1 ;+ 2 ; NAME: 3 ; COLORBAR 4 ; 5 ; PURPOSE: 6 ; The purpose of this routine is to add a color bar to the current 7 ; graphics window. 8 ; 9 ; CATEGORY: 10 ; Graphics, Widgets. 11 ; 12 ; CALLING SEQUENCE: 13 ; COLORBAR 14 ; 15 ; INPUTS: 16 ; None. 17 ; 18 ; KEYWORD PARAMETERS: 19 ; 20 ; BOTTOM: The lowest color index of the colors to be loaded in 2 ; 3 ; @file_comments 4 ; The purpose of this routine is to add a color bar to the current 5 ; graphics window. 6 ; 7 ; @categories Graphics, Widgets. 8 ; 9 ; @keyword BOTTOM The lowest color index of the colors to be loaded in 21 10 ; the bar. 22 11 ; 23 ; CB_CHARSIZE:The character size of the color bar annotations. Default is 1.0.24 ; 25 ; CB_CHARTICK:The character thick of the color bar annotations. Default is 1.0.26 ; 27 ; CB_COLOR:The color index of the bar outline and characters. Default12 ; @keyword CB_CHARSIZE The character size of the color bar annotations. Default is 1.0. 13 ; 14 ; @keyword CB_CHARTICK The character thick of the color bar annotations. Default is 1.0. 15 ; 16 ; @keyword CB_COLOR The color index of the bar outline and characters. Default 28 17 ; is ncolors - 1 + bottom. 29 18 ; 30 ; CB_LOG:to get logarithmic scale for the colorbar31 ; 32 ; CB_TITLE:This is title for the color bar. The default is to have19 ; @keyword CB_LOG to get logarithmic scale for the colorbar 20 ; 21 ; @keyword CB_TITLE This is title for the color bar. The default is to have 33 22 ; no title. 34 23 ; 35 ; DISCRET: Vecteur contenant les incices des couleurs a tracer en barre36 ; de couleur. On obtient ainsi une barre de couleur discrete ne comportant que37 ; les couleurs specifiees ds l'ordre ou elles apparaissent ds le vecteur.38 ; 39 ; DIVISIONS:The number of divisions to divide the bar into. There will24 ; @keyword DISCRETE Vector which contain color's indexes to trace in a color bar. Therefore 25 ; we obtain a discreet color bar which only contains specified colors in 26 ; order where they appear in the vector 27 ; 28 ; @keyword DIVISIONS The number of divisions to divide the bar into. There will 40 29 ; be (divisions + 1) annotations. The default is 2. 41 30 ; 42 ; FORMAT: The format of the bar annotations. Default is '(F6.2)'. 43 ; 44 ; CB_LABEL: C''est un vecteur qui specifie la valeur des sticks 45 ; presents dans la barre de couleur. Il permet qd on utilise 46 ; DISCRET d''avoir des couleurs qui ne s''incrementent pas de 47 ; facon regulieres. 48 ; 49 ; MAX: The maximum data value for the bar annotation. Default is 31 ; @keyword FORMAT The format of the bar annotations. Default is '(F6.2)'. 32 ; 33 ; @keyword CB_LABEL It is a vector who specifie sticks's value attend in the color bar. 34 ; It allowes, when we use DISCREET, to have colors which don't increase 35 ; by increments in a regular way. 36 ; 37 ; @keyword MAX The maximum data value for the bar annotation. Default is 50 38 ; NCOLORS-1. 51 39 ; 52 ; MIN:The minimum data value for the bar annotation. Default is 0.53 ; 54 ; NCOLORS:This is the number of colors in the color bar.55 ; 56 ; NOTITLE: oblige a ne pas mettre de titre meme si cb_title est declare57 ; 58 ; POSITION:A four-element array of normalized coordinates in the same40 ; @keyword MIN The minimum data value for the bar annotation. Default is 0. 41 ; 42 ; @keyword NCOLOR This is the number of colors in the color bar. 43 ; 44 ; @keyword NOTITLE Force to don't writte title even if CB_TITLE is declarerd. 45 ; 46 ; @keyword POSITION A four-element array of normalized coordinates in the same 59 47 ; form as the POSITION keyword on a plot. Default is 60 48 ; [0.88, 0.15, 0.95, 0.95] for a vertical bar and 61 49 ; [0.15, 0.88, 0.95, 0.95] for a horizontal bar. 62 50 ; 63 ; PSCOLOR:This keyword is only applied if the output is being sent to51 ; @keyword PSCOLOR This keyword is only applied if the output is being sent to 64 52 ; a PostScript file. It indicates that the PostScript device 65 53 ; is configured for color output. If this keyword is set, then … … 74 62 ; are outputting to a color PostScript printer. 75 63 ; 76 ; RIGHT:This puts the labels on the right-hand side of a vertical64 ; @keyword RIGHT This puts the labels on the right-hand side of a vertical 77 65 ; color bar. It applies only to vertical color bars. 78 66 ; 79 ; TOP:This puts the labels on top of the bar rather than under it.67 ; @keyword TOP This puts the labels on top of the bar rather than under it. 80 68 ; The keyword only applies if a horizontal color bar is rendered. 81 69 ; 82 ; VERTICAL:Setting this keyword give a vertical color bar. The default70 ; @keyword VERTICAL Setting this keyword give a vertical color bar. The default 83 71 ; is a horizontal color bar. 84 72 ; 85 ; COMMON BLOCKS: 86 ; None. 87 ; 88 ; SIDE EFFECTS: 89 ; Color bar is drawn in the current graphics window. 90 ; 91 ; RESTRICTIONS: 92 ; The number of colors available on the display device (not the 73 ; @restrictions Color bar is drawn in the current graphics window. 74 ; 75 ; @restrictions The number of colors available on the display device (not the 93 76 ; PostScript device) is used unless the NCOLORS keyword is used. 94 77 ; 95 ; EXAMPLE: 96 ; To display a horizontal color bar above a contour plot, type: 97 ; 98 ; LOADCT, 5, NCOLORS=100 99 ; CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $ 100 ; C_COLORS=INDGEN(25)*4, NLEVELS=25 101 ; COLORBAR, NCOLORS=100 102 ; 103 ; MODIFICATION HISTORY: 104 ; Written by: David Fanning, 10 JUNE 96. 78 ; @examples To display a horizontal color bar above a contour plot, type: 79 ; 80 ; IDL> LOADCT, 5, NCOLORS=100 81 ; IDL> CONTOUR, DIST(31,41), POSITION=[0.15, 0.15, 0.95, 0.75], $ 82 ; IDL> C_COLORS=INDGEN(25)*4, NLEVELS=25 83 ; IDL> COLORBAR, NCOLORS=100 84 ; 85 ; @history Written by: David Fanning, 10 JUNE 96. 105 86 ; 10/27/96: Added the ability to send output to PostScript. DWF 106 87 ; 11/4/96: Substantially rewritten to go to screen or PostScript … … 113 94 ; 3/3/98: ajout du keyword discret par 114 95 ; sebastien (smasson@lodyc.jussieu.fr) 96 ; 97 ; @version $Id$ 98 ; 115 99 ;- 116 100 117 101 PRO COLORBAR, BOTTOM=bottom, CB_CHARSIZE=cb_charsize, CB_CHARTHICK=cb_charthick $ 118 102 , CB_COLOR=cb_color, $ 119 DIVISIONS=divisions, DISCRET =discret,CB_LABEL = cb_label, $103 DIVISIONS=divisions, DISCRETE=discrete,CB_LABEL = cb_label, $ 120 104 FORMAT=format, POSITION=position, MAX=max, MIN=min, NCOLORS=ncolors, $ 121 105 PSCOLOR=pscolor, CB_TITLE=cb_title, VERTICAL=vertical, TOP=top, RIGHT=right, CB_LOG = CB_log, _extra = ex … … 189 173 190 174 IF KEYWORD_SET(vertical) THEN BEGIN 191 IF KEYWORD_SET(discret ) THEN begin192 facteur=256/n_elements(discret )193 discret =reform(replicate(1,facteur) # discret,facteur*n_elements(discret), /overwrite)194 bar = REPLICATE(1B,10) # discret 175 IF KEYWORD_SET(discrete) THEN begin 176 facteur=256/n_elements(discrete) 177 discrete=reform(replicate(1,facteur) # discrete,facteur*n_elements(discrete), /overwrite) 178 bar = REPLICATE(1B,10) # discrete 195 179 endif else bar = REPLICATE(1B,10) # BINDGEN(256) 196 180 IF N_ELEMENTS(position) EQ 0 THEN position = [0.88, 0.15, 0.95, 0.95] 197 181 ENDIF ELSE BEGIN 198 IF KEYWORD_SET(discret ) THEN begin199 facteur=256/n_elements(discret )200 discret =reform(replicate(1,facteur) # discret,facteur*n_elements(discret), /overwrite)201 bar = discret # REPLICATE(1B,10)182 IF KEYWORD_SET(discrete) THEN begin 183 facteur=256/n_elements(discrete) 184 discrete=reform(replicate(1,facteur) # discrete,facteur*n_elements(discrete), /overwrite) 185 bar = discrete # REPLICATE(1B,10) 202 186 endif else bar = BINDGEN(256) # REPLICATE(1B, 10) 203 187 IF N_ELEMENTS(position) EQ 0 THEN position = [0.15, 0.88, 0.95, 0.95] … … 205 189 206 190 ; Scale the color bar. 207 IF NOT KEYWORD_SET(discret ) THEN $191 IF NOT KEYWORD_SET(discrete) THEN $ 208 192 bar = BYTSCL(bar, TOP=ncolors-1) + bottom 209 193
Note: See TracChangeset
for help on using the changeset viewer.