Changeset 286 for trunk


Ignore:
Timestamp:
09/14/07 15:19:43 (17 years ago)
Author:
smasson
Message:

slight improve of pltv

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/ToBeReviewed/PLOTS/DESSINE/pltv.pro

    r263 r286  
    1919; @param MAX {in}{optional}{default=max of DATA (on non-masked points)} 
    2020; 
    21 ; @keyword BOTTOM {default=0} 
    22 ; The lowest color index of the colors to be used 
     21; @keyword BOTTOM {default=1} 
     22; The lowest color index of the colors to be used. 
    2323; 
    2424; @keyword BOXZOOM 
     
    4040; The color number that should be used for the mask values. 
    4141; 
     42; @keyword INV 
     43; Reverse the color order 
     44; 
    4245; @keyword MASKVAL {default=1.e+20} 
    4346; The mask value. Note that if abs(mask) < 1.e6, then the 
     
    7174; 
    7275PRO pltv, data, min, max, BOTTOM = bottom, BOXZOOM = boxzoom $ 
    73           , C_MASK = c_mask, C_NAN = c_nan, MININ = minin, MAXIN = maxin $ 
     76          , C_MASK = c_mask, C_NAN = c_nan, INV = inv,  MININ = minin, MAXIN = maxin $ 
    7477          , MASKVAL = maskval, NCOLORS = ncolors, NOINTERP = nointerp $ 
    7578          , _EXTRA = ex 
     
    103106;------------------------------------------------------------ 
    104107  ncolmax = !d.n_colors < 256 
    105   IF n_elements(bottom) EQ 0 THEN bottom = 1 
    106   IF NOT keyword_set(ncolors) then ncolors = ncolmax - 1 - bottom 
    107   topcol = (bottom + ncolors - 1) < (ncolmax - 1) 
     108  IF n_elements(bottom) EQ 0 THEN bottom = 1 ELSE bottom = 0 > bottom 
     109  IF NOT keyword_set(ncolors) then topcol = ncolmax - 2 ELSE topcol = (bottom + ncolors - 1) < (ncolmax - 1) 
     110  ncolors = topcol - bottom + 1 
    108111;------------------------------------------------------------ 
    109112; Do we have NaN values in z2d??? 
     
    153156    z2d[maskind] = cmask 
    154157  ENDIF 
     158; reverse colors (from topcol to bottom instead of bottom to topcol) 
     159  IF keyword_set(inv) THEN BEGIN 
     160    m = float(topcol   - bottom  )/float(bottom - topcol) 
     161    p = float(bottom^2 - topcol^2)/float(bottom - topcol) 
     162    z2d = m * temporary(z2d) + p 
     163  ENDIF 
     164; avoid rounding errors 
    155165  z2d = round(temporary(z2d)) 
    156166; use byte type to save memory 
     
    184194            , INTERVALLE = float(max-min)/(topcol-bottom) $ 
    185195            , _extra = ex 
    186    plot, [0], [0], /noerase, /nodata, xstyle = 1, ystyle = 1 
     196   plot, [0], [0], /noerase, /nodata, xstyle = 1, ystyle = 1, _extra = ex 
    187197 
    188198   IF keyword_set(masked) THEN tracemask, msk, indgen(dtasize[0]), indgen(dtasize[1]) 
     
    190200; color bar 
    191201;------------------------------------------------------------ 
    192    barrecouleur, 0, min,  max, 10, bottom = bottom, position = posbar, ncolors = (topcol-bottom+1), _extra = ex 
     202   IF keyword_set(inv) THEN colors = topcol - bindgen(ncolors) ELSE colors = bottom + bindgen(ncolors) 
     203   barrecouleur, colors, min,  max, 10, position = posbar,  _extra = ex 
    193204; 4) End of drawing 
    194205   terminedessin, _extra=ex 
Note: See TracChangeset for help on using the changeset viewer.