## xautorange and yautorange attributes

Version 2.32
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.`` See also gallery examples scatterplot10, stockday, and mouse.``

## Examples

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

Example: `xautorange: datafield=1 nearest=monday`

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

## Settings

The `datafield` setting must be specified, and it must be leftmost.`` All other settings are optional and should default to reasonable behavior.``

`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 `datafield`s.``
  `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.``

`nearest=`s

  Set the min and max to fall on round boundaries.`` For instance, `nearest=10` can be used to ensure that the axis min and max will always fall at an even multiple of 10. `nearest=month` ensures that the axis min and max will fall on an even month boundary.``

  With numeric data, s can be any number greater than zero. For date, time, and datetime data s is a controlled vocabulary (see below).`` If plotting numeric data and `nearest` is not specified, a reasonable s will be selected.`` If plotting date, time, or datetime data and `nearest` is not specified, `datematic` will be used (previously to 2.31 `exact` was the default).``

  Example: `nearest=100` and the data range from 23 to 1162, the plot's range will be 0 to 1200.``

  Possible values for `nearest` are shown below. For each, the applicable data types are shown in parentheses.``

      nearest=   range min and max will be set to:
      --------  ---------------------------------
      0.1       the nearest multiple of 0.1 (numeric data)
      10        the nearest multiple of 10 (numeric)
      1000      the nearest multiple of 100 (numeric)
      (etc... any number value can be used for numeric data)

      exact     the exact min and max as found in the data (any data type)

      datematic  a reasonable default will be used (date, time, datetime, 2.31+)
      minute    the nearest 1 minute boundary (time data, 2.31+)
      10minute  the nearest 10 minute boundary (time data, 2.31+)
      20minute  the nearest 20 minute boundary (time data, 2.31+)
      30minute  the nearest 30 minute boundary (time data, 2.31+)
      hour      the nearest 1 hour boundary (time, datetime)
      3hour     the nearest 3 hour boundary (time, datetime, 2.31+)
      6hour     the nearest 6 hour boundary (time, datetime, 2.31+)
      12hour    the nearest 12 hour boundary (time, datetime, 2.31+)
      day       the nearest day boundary (datetime)
      sunday    the nearest Sunday (date, datetime, 2.31+)
      monday    the nearest Monday (date, datetime, 2.31+)
      month     the nearest month boundary (date, datetime)
      quarter   the nearest 3 month boundary (date, datetime)
      3month    same as quarter
      year      the nearest year boundary (date, datetime)
      2year     the nearest 2 year boundary (date, datetime, 2.31+)
      5year     the nearest 5 year boundary (date, datetime, 2.31+)
      10year    the nearest 10 year boundary (date, datetime, 2.31+)

`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`.)

`incmult=`h

  a more automatic way to get the equivalent of `margin` with numeric data. If specified, the default scale increment (same as used by proc axis stubs: inc) will be used for the margin. h can be set to 1 to use the increment as is, or it can be set to a value such as 2 to double it. The default h is 1.0.`` The low end of the range will not dip below zero if data are all positive.
  Example: `yautorange datafield=2 incmult=2.0`

`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+)

`numformat=`printfspec

  This allows user control over the internal string-based representation of minima and maxima for numerics. Default is `%g` which handles scientific-notation values and non-extreme numerics. Try `%f` if your data include extreme numerics that aren't in scientific notation.``

`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.``
  data display engine
  Copyright Steve Grubb

Markup created by unroff 1.0, `` `` August 23, 2005.