PLTcolorMap TCL UTILITIES USER MANUAL PLTcolorMap
SYNOPSIS
Derive a color mapping coefficients
PACKAGE
TCLPLT
NAME
PLTcolorMap
USAGE
set rV  PLTcolorMap  Min Max Sca White cMap
INPUT DEFINITIONS
Min - The minimum value being mapped. This will map to color table index 0.
Max - The maximum value being mapped. This will map to color table index 254 if White is NO, otherwise it will map to 255.
Sca - The scaling to use when mapping the values to color table index. This is either LOG or LINEAR.
White - Include or exclude the maximum color table index (255 which is usually white) from the mapping. To include set to YES, to exclude set to NO.
cMap - The color mapping coefficients.
RETURN DEFINITION
None.
DESCRIPTION
PLTcolorMap derives the color mapping coefficients which will map the values from Min to Max to the color table indices 0 to 254 if White is NO or 0 to 255 if White is YES. The mapping will be scaled according to Sca. The mapping coefficients are returned in cMap. The mapping coefficients are identical to thos which would be produced by the ColorBar procedure with the same inputs but PLTcolorMap does now output to the canvas. The mapping coefficients are used as input into a number of procedures including Plot3D and PLTvalueColor.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:Define a color mapping and use in a 3D plot.
# SET up an array of data consisting of 5 displaced gaussians 

set nP 0
for { set X -6.0 } { $X <= 6.0 } { set X [expr $X + .1] } {
   for { set Y -6.0 } { $Y <= 6.0 } { set Y [expr $Y + .1] } {
       set Xx($nP) $X
       set Yy($nP) $Y
       set R [expr -($X * $X + $Y * $Y) / 3.0]
       set Ra [expr -(($X - 3) * ($X - 3) + ($Y - 3) * ($Y - 3)) / 6.0]
       set Rb [expr -(($X - 3) * ($X - 3) + ($Y + 3) * ($Y + 3)) / 6.0]
       set Rc [expr -(($X + 3) * ($X + 3) + ($Y + 3) * ($Y + 3)) / 6.0]
       set Rd [expr -(($X + 3) * ($X + 3) + ($Y - 3) * ($Y - 3)) / 6.0]
       set Vv($nP) [expr exp($R) + exp($Ra) + exp($Rb) + exp($Rc) + exp($Rd)]
       incr nP
   }
}

# SET up the grid information array.  This defined a matix of 100x100 grids
#   with a range from (-6,-6) to (6,6)

set gInfo(0) -6.0
set gInfo(1) 6.0
set gInfo(2) -6.0
set gInfo(3) 6.0
set gInfo(4) 100
set gInfo(5) 100
set gInfo(6) POINT
set gInfo(7) POINT
set gInfo(8) COLUMN
set gInfo(9) IGNORE
set gInfo(10) NEW:ADD:END
set gInfo(11) -1
set gInfo(12) -5
set gInfo(13) -1.0e30
set gInfo(14)  1.0e30
set gInfo(15)  NO
set gInfo(16)  NO

# GRID the data

TUdataGrid $nP 1 Xx Xx 1 Yy Yy Vv Grid Norm gInfo

# SET a window size

set GphInfo(xsScrL) 600
set GphInfo(ysScrL) 500
set GphInfo(xScrL) 600
set GphInfo(yScrL) 500

# Turn on graphics with a RainBow colorbar, background will be black 

GraphicsOn TK RainBow 

# DEFINE a square window and assign a plot to it.  Set the plot up for
#   AUTO plotting with Plot3D

SqWindow 0 0.10 0.10 0. 0.8 -6. -6. 0. 6. 6. 0.
DefinePlot 0 0 $gInfo(4) $gInfo(5) 

# SET up a color mapping

PLTcolorMap 0.05 1.5 LOG NO cA

# PLOT the data using the above color mapping

Plot3D 0 Xb Yb DUMMY DUMMY Grid AUTO DUMMY cA

# Outline and annotate the plot

PlotOutlines 0 [list "" 1.0 "" 1.0] [list BOT BOT BOTH BOTH]
      
Apr 13, 2007