Contour TCL UTILITIES USER MANUAL Contour
SYNOPSIS
Produce contours of gridded data.
PACKAGE
TCLPLT
NAME
Contour
USAGE
Contour  pID G gI cOps
INPUT DEFINITIONS
pID - The plot identifier in which the contour will be produced. This was set in a call to DefinePlot.
G - The data grid array. This was created in a call to TUdataGrid
gI - The data grid information array used when setting up the data grid.
cOps - An array which contains all of the options to use in producing the contour plot. The complete list of parameters is given in the procedure description below.
RETURN DEFINITION
None
DESCRIPTION
Contour contours the data in G in the plot pID. The grid of data should have been created through a call to TUdataGrid using the grid information provided in gI. The procedure has multiple options which are used when outputting the contours. These can be changed from their default settings through the cOps array. A complete listing of the array elements is given in the table below.
INDEX DEFAULT DESCRIPTION
CFMT MONOCHROMATIC The contour format. This is either COLOR or MONOCHROMAIC
CLAB UNLABELED Contour labels. This can either be LABELED or UNLABELED. The option is currently unsupported.
LSIZE Size of contour labels. The option is currently unsupported.
LCOL Color of contour labels. If set to -1 the label is colored according to the contour level value. The option is currently unsupported.
CLEV AUTO Contour level generation. This can be either AUTO or MANUAL. When AUTO the contour levels determined from the input number of levels (NLEV) and the minimum (LMIN and maximum (LMAX) contour level. When MANUAL the levels are those input by the user (L#).
NLEV 1 The number of contour levels to generate.
LMIN 0.0 The value of the minimum contour level.
LMAX 1.0 The value of the maximum contour level.
LSCA LINEAR The scaling to use when AUTO generating the contour levels. This can be with LINEAR or LOG.
L# Contour levels when used only when CLEV has be set to manual. # is the contour level and runs from 1 to NLEV. There must be one contour level defined for each NLEV levels.
CCOL 255 Index into the color table of the contour level color to use when CFMT has been set to MONOCHROMATIC.
CMIN Value associated with the color look up table index 0 when CFMT has been set to COLOR.
CMAX Value associated with the color look up table index 254 when CFMT has been set to COLOR.
IGNB -1.0e31 Values <= this value are not included the contours.
DFMT RECTANGULAR The data grid format. This can be either RECTANGULAR or POLAR. In a POLAR grid the X values are azimuths and the Y are radii. The values are converted to CARTESIAN values when plotted.
As of yet the procedure does not support the labeling of the contour levels. Also the transformation from value to color has the same scaling (linear or log) as is set for the scaling of the contour levels in LSCA.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1: Examples of different contour plots.
# SET up an array of data consisting of 2 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 Ra [expr $X * $X + $Y * $Y]
       set Rb [expr ($X - 2) * ($X - 2) + ($Y - 2) * ($Y - 2)]
       set Vv($nP) [expr exp (-$Ra / 6.0) + exp (-$Rb / 2.0)]
       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 4 square windows and assign a plot to each.

SqWindow 0 0.10 0.10 0. 0.4 -6. -6. 0. 6. 6. 0.
SqWindow 1 0.50 0.10 0. 0.4 -6. -6. 0. 6. 6. 0.
SqWindow 2 0.10 0.55 0. 0.4 -6. -6. 0. 6. 6. 0.
SqWindow 3 0.50 0.55 0. 0.4 -6. -6. 0. 6. 6. 0.
DefinePlot 0 0 -1 -1 
DefinePlot 1 1 -1 -1 
DefinePlot 2 2 -1 -1 
DefinePlot 3 3 -1 -1 

# Define a contour plot.  Contours are in color and linearly spaced from
#  0.0 to 1.2.  There are 20 contour levels.  Color range matches the 
#  contour range.

set cOps(CFMT) COLOR
set cOps(CLEV) AUTO
set cOps(LMIN) 0.0
set cOps(LMAX) 1.2
set cOps(LSCA) LINEAR
set cOps(NLEV) 20
set cOps(CMIN) 0.0
set cOps(CMAX) 1.2

# Produce the contours in the lower left-hand plot definitiom

Contour 0 Grid gInfo cOps

# Outline and annotate the plot

PlotOutlines 0 [list "" 1.0 "" 1.0] [list BOT BOT BOTH BOTH]

# Same a contour plot but now the contours are log scaled.  Need to change
#   the minimum values so they are > 0.0.

set cOps(LMIN) 0.01
set cOps(CMIN) 0.01
set cOps(LSCA) LOG

# Produce the contours in the lower right-hand plot definition

Contour 1 Grid gInfo cOps

# Outline and annotate the plot

PlotOutlines 1 [list "" 1.0 "" 1.0] [list BOT BOT BOTH BOTH]

# CHANGE to a 10 level contour with the levels manually defined.

set cOps(CLEV) MANUAL
set cOps(NLEV) 10
set cOps(L1)  1.2
set cOps(L2)  1.15
set cOps(L3)  1.1
set cOps(L4)  1.0
set cOps(L5)  .6
set cOps(L6)  .2
set cOps(L7)  .07
set cOps(L8)  .05
set cOps(L9)  .03
set cOps(L10) .01

# Produce the contours in the upper left-hand plot definition

Contour 2 Grid gInfo cOps

# Outline and annotate the plot

PlotOutlines 2 [list "" 1.0 "" 1.0] [list NONE BOT BOTH BOTH]

# BACK to a log space set of contours but all in green.

set cOps(CLEV) AUTO
set cOps(LMIN) 0.01
set cOps(LMAX) 1.2
set cOps(LSCA) LOG
set cOps(CFMT) MONOCHROMATIC
set cOps(CCOL) $GphInfo(Green)

# Produce the contours in the upper right-hand plot definition

Contour 3 Grid gInfo cOps

# Outline and annotate the plot

PlotOutlines 3 [list "" 1.0 "" 1.0] [list NONE BOT BOTH BOTH]
      
Apr 7, 2007