AutoScale TCL UTILITIES USER MANUAL AutoScale
SYNOPSIS
Auto-scale a plot axis
PACKAGE
TCLPLT
NAME
AutoScale
USAGE
AutoScale  pID Axis Data nP {Ops}
INPUT DEFINITIONS
pID - The plot iD of the axis being autoscaled. This is set in the call to the DefinePlot procedure.
Axis - The axis being autoscaled. In an BOX format plot this is: Xb for the lower X axis; Xt for the upper X axis; Yl for the left Y axis; and Yr for the right Y axis. For a CROSSHAIR plot this is Xb for the X axis and Yl for the Y axis.
Data - The data array used to autoscale the axis.
nP - The number of elements in the data consecutive elements in the Data array to search when determining the autoscale range. This must be less than or equal to the array length.
Ops - An optional list of options which can be used to control certain aspects of the autoscaling. The options are defined below together with their default values. Any element set to OFF or not specified in the list is set to its default value within the procedure.
NumOps List Definition
INDEX DEFAULT DEFINITION
0 -1.0e-33 Ignore all data below this value.
1 1.0e33 Ignore all data above this value.
2 OFF If the minimum data value is larger than this value, set it to this value. Set to OFF to ignore this option.
3 OFF If the maximum data value is less than this value, set it to this value. Set to OFF to ignore this option.
4 OFF After auto-scaling, linearly shift the scaling so that the minimun is at this value. Set to OFF to ignore this option.
5 OFF After auto-scaling, linearly shift the scaling so that the maximun is at this value. Set to OFF to ignore this option.
6 -1.0 On a linear scaled axis the axis range is computed so that all of the major tick marks occur at integral multiple of this value. Set to -1.0 to ignore this option.
7 OFF Autoscale a log scaled axis as if it were linear. This allows the maximum and minumum scaling value to be a value other than an integral power of 10. Set to OFF to ignore this option or ON to set it.
8 0 When searching the data array begin at this location. If N is the setting for this element then N + nP must be less than or equal to the number of elements in the Data array. Set to 0 begin at the array beginning.
RETURN DEFINITION
NONE
DESCRIPTION
AutoScale scales a plot axis according to the values in the Data array. The routine ensures that all of the data will fit within the plot and that the major tick marks along the axis have "reasonable" values associated with them. The procedure auto differentiates between LINEAR and LOG scaled axis.
An optional list of processing options allows the user to control some of the autoscale functionality. Upper and lower limits can be set both on the maximum and minimum values found in the Data array as well as in the assigned autoscale range. The autoscale range can be shifted by specifying an absolute maximum or minimum value. Log scaled axes can be autoscaled as if they were linear scaled which allows for the maximum and minimum axis scaling to be a non-integral power of 10. Also the user can specify a base value such that the axis range is set so that all of the major tick marks are assigned integral multiples of this value.
ERRORS
None Generated
C BACKING
No
EXAMPLE(S)
EXAMPLE 1:Autoscale the 4 axes of a BOX format plot.
# READ the GUI preference settings

GUIprefsRead

# SET a window size

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

# START graphics

GraphicsOn TK RainBow

# ESTABLISH graphics window 

GenWindow 1 0.15  0.15 0.0 0.85 0.85  0.0 -6.0 1.0 0.0 6.0 10 0.0

# SET both the SECONDARY X and Y axes to be LOG scaled

SetAxis 1 SECONDARY 10.0 10.0 HOLD 1.0e5 1.0e5 HOLD LOG LOG HOLD

# ASSOCIATE plot id 1 with window 1

DefinePlot 1 1 -1 -1 

# SET all annotation to be 10 pt

PLTinfoChg 1 ALL NUMBERS NSIZE 10
PLTinfoChg 1 ALL NUMBERS TSIZE 10

# PROVIDE a data range to autoscale over

set Data(0) 3.3 
set Data(1) 1.4607e7

# AUTOSCALE top X in default mode and right Y as a linear axis.

AutoScale 1 Xt Data 2 
AutoScale 1 Yr Data 2 [list OFF OFF OFF OFF OFF OFF OFF ON] 

# PROVIDE a data range to autoscale over and autoscale the lower X axis
#   in default mode

set Data(0) 3.3 
set Data(1) 5.4
AutoScale 1 Xb Data 2 

# PROVIDE a data range to autoscale over and autoscale the left Y axis
#   to ensure that all of the numerical labels are an integral multiple
#   of 0.6

set Data(0) -3.3 
set Data(1) 5.4
AutoScale 1 Yl Data 2 [list OFF OFF OFF OFF OFF OFF 0.6 OFF] 

# OUTLINE and annotate the plot

PlotOutlines 1 [list "X" 1.0 "Y" 1.0] [list BOTH BOTH BOTH BOTH]
      
Mar 29, 2007