xautorange and yautorange attributes


Version 2.30

Scripts


Manual page for xautorange_and_yautorange_attributes(PL)

Usage

xautorange: datafield=dfields other settings..
or..
yautorange: datafield=dfields other settings..


Automatic axis range determination

xautorange and yautorange are attributes of proc areadef that allow axis range to be automatically determined based on the range of the data.

Default autorange behavior is as follows: For numeric data the range is set to the nearest whole high and low scale increments that encompass the min and max of the data. For date and time data the range is set to the exact min and max of the data. See also gallery examples scatterplot10, stockday, and mouse.


Settings

The datafield setting must be specified, and it must be leftmost.

datafield=dfields

This setting must be given first (to the left of any other). It specifies one or more data fields that will be scanned to automatically find minima and maxima. dfields may be a single dfield or a comma-delimited list of several dfields with no embedded space. Unless a combomode= setting is used, all fields will be treated independently when searching for a minima and maxima. Invalid or non-existant dfields will be silently ignored, but there must be at least one valid dfield. Support for multiple fields contributed by Paul Totten.
Example: yautorange datafield=2
Example: yautorange datafield=2,4,5

combomode=stack | combomode=hilo

If specified, an alternate method of min/max determination is used with multiple datafields.
stack = sum the data field contents (useful when generating stacked bar graphs).
hilo = take the sum and difference of data field contents; useful when ranging on two fields, and one data field will be driving error bars.

The following settings allow autorange behavior to be controlled explicitly:

incmult=h

controls the amount of margin at high and low end when working with numeric data in default mode as described above. The default h is 1.0. The scale increment will be multiplied by h before determining the range. The low end of the range will not dip below zero if data are all positive.
Example: yautorange datafield=2 incmult=2.0

nearest=s

may be used to explicitly define the extent of the range, to a boundary corresponding to a round value of your choice. If you do not specify a nearest= value autorange will guess based on the magnitude of the data. If nearest=exact is specified, the range will be the exact minima to the exact maxima. See the table below for some possible values for s. An example: if s is 100, and the data range from 23 to 1162, the plot's range will be 0 to 1200. The following illustrates some possible values for nearest=s:
s         range min and max will be set to:
-------   ---------------------------------
10        the nearest multiple of 10
0.1       the nearest multiple of 0.1
month     the nearest month boundary (date or datetime scaletypes only)
quarter   the nearest quarter-year boundary (date or datetime only)
year      the nearest year boundary (date or datetime only)
hour      the nearest hour boundary (time or datetime only)
day       the nearest day boundary (datetime only)
exact     the exact minima and maxima
(none)    a reasonable default (numeric data only)


margin=m

If specified, m basic units will be added to the maxima and also subtracted from the minima, before considering nearest. This may be used to guarantee margins at each end of the range. (Basic units are days for date and datetime scaletypes; and minutes for time.)

lowfix=lowval

If specified, the minima will always be lowval. This is useful when you want only the maxima to be automatically set based on data.
Example: yautorange: datafield=2 lowfix=0

hifix=hival

If specified, the maxima will always be hival. This is useful when you want only the minima to be automatically set based on data.

mininit=lowval

Like lowfix but is overridden by encountered data values less than lowval. Useful for example if you want your axis min to be zero except when there is an occasional negative data value. (2.30+)

maxinit=hival

Like hifix but is overridden by encountered data values greater than hival. (2.30+)

mininit=lowval

Like lowfix but is overridden by encountered data values lower than lowval.

numformat=printfspec

This allows user control over the internal string-based representation of minima and maxima for numerics. Default is %g. Try %f if you're encountering problems involving very large or very small numeric quanitities.

selectrows=conditional expression

This allows a select expression to be applied in order to select data rows to be tested when scanning for minima and maxima. If specified, this setting must be the last (rightmost) on the line, and will have embedded spaces, unlike the other settings. See example below.


Variables that are set by autorange

DATAXMIN, DATAXMAX

The actual minima and maxima of the data field when ranging in X. Different from XMIN and XMAX in that these do not include any margin.

DATAYMIN, DATAYMAX

The actual minima and maxima of the data field when ranging in Y. Different from YMIN and YMAX in that these do not include any margin.


Examples

Example: xautorange: datafield=2 nearest=month margin=31

Example: yautorange: datafield=3,4,5,6,7 selectrows=@@sex = f


data display engine  
Copyright Steve Grubb


Markup created by unroff 1.0,    August 26, 2004.