ploticus: gallery - scaling and axes examples

## Gallery - Scaling and axes examples | Welcome Gallery Handbook |
| Manual page for Gallery_-_Scaling_and_axes_examples(PL)

Ploticus includes an array of options for defining aspects such as the plot area and the creation of axes. Data scaling options include simple linear, log, date, time, datetime, and categories.

#
Basics

sa1
Area definition
Before plotting data, a scaled area must be defined. proc areadef is used to set up a plotting area, and to define its size, scaling, and location on the "page".

Axes
Next, proc axis is invoked to render the X (horizontal), and Y (vertical) axes. A typical axis is a line with some number of regularly placed marks called tics, each of which has a label called a stub. The axis often has a descriptive text label nearby. In this example, text stubs appear in the X axis. The X axis range is from 0 to 5, to allow room for the four stubs, which are placed at consecutive locations, as are the bars. The Y axis is linear numeric with incremental stubs every 20 units; there are also "minor tics" along the Y axis, at every 2 units.

#
Simple linear scaling with regular stubs

Generated incremetally (numeric). The min, max, and stub increment may be automatically determined or specified manually.

Specified literally (alphanumeric). Literal stubs may be specified in one of these ways:

- given in the script on multiple lines
- given in the script as a list
- taken from a data field
- taken from an external file
  (By default literal stubs begin at X=1 or Y=1, rather than at 0, since this is usually the desired result, for bar placement, etc. This may be overridden using stubrange: 0)

  #
  Self-locating stubs

  "Self-locating stubs" are stubs that contain their own location By using these, stubs and tics may be placed at irregular locations. The underlying scale type is usually simple linear, but it can be any type. Self-locating stubs may be...
- given in the script on multiple lines
- taken from a data field
- taken from an external file
  Other examples:
- lineplot3
- hbars4

  #
  Log scaling

  Examples of logarithmic scaling.

  #
  Scale by category

  The categories scale type allows non-numeric tags to be plotted directly. This scale type may be useful when rendering scatterplots, and bar displays (for bar placement), etc. Categories do not have to be used in order to make text stubs; often stubs, bars, etc. are placed sequentially, i.e. "as they fall", with the underlying scale type being simple linear numeric, and this is often satisfactory. However, the use of categories as the scale type ensures that data are being displayed at the correct location.
  More examples:
- timely
- timeline1
- timeline2
- timeline3

  A variation of categories scaling is pltab scaling. This may be used with the pltab program; the row stubs are automatically taken as categories in Y.

  A further extension to the above is pltab_row scaling, where row stubs serve as an anchor to a mini Y axis with its own scaling. An example of this is caselist.

  #
  Date scaling

  The date scale type allows date values to be plotted directly. Like other time measures, dates are almost always plotted against the X axis. A wide variety of date notations are supported.
  More examples:

- lineplot4
- timeline2
- sa4a (same as sa4 except for year tics)
- year divided into quarters

  #
  Time scaling

  The time scale type allows time values to be plotted directly. A variety of different time notations are supported.
  More examples:

- timeline3

  #
  Datetime scaling

  The datetime scale type allows time values to be plotted directly across multiple days. A datetime datafield consists of a date value and a time value connected by a dot (.). The date and time values may be in any of the supported plotting formats.
  hitcount

  Another example:

- hitcount2 has time increments along x axis

  # Datetime scaling, with time windowing

  Sometimes it is desirable to show only portions of each day, when showing the entire 24 hour day would be too much. Examples of this include a work day or a trading day. datetime scaling allows you to do this- you can indicate the time range for each day at the end of the datetime keyword. For example, `datetime9-17` would show only the hours from 9:00 to 17:00 for each day. See scaleunits for more details on using datetime with time windowing.

  Example:

- hitcount3 demonstrates time windowing

  #
  Other axes rendering capabilities

  ###
  Multiple areas per "page"

  sa2
  Any number of plotting areas may be rendered on a page. (more of an issue when rendering onto paper). Each has its own proc areadef.

  ###
  Broken axes

  Broken axis plots, where an axis is broken to allow compact display of extreme value(s), may be done. (It requires manual "tweaking" and cannot really be automated.) See the example brokenaxis.

  ###
  Axes in unusual places

  Although Y axis is usually done on the left, and X axis along the bottom, axes can be placed anywhere.

  ###
  Overlay of multiple scales

  Two or more coordinate systems may be overlaid, using multiple #proc areadef invocations that plot into the same rectangle.

  ###
  Overlay of multiple axes

  This example has two X axes overlaid, in order to do two different systems of grid lines. Try this strategy if you have more complicated requirements for tics, stubs, or grid lines.
  data display engine
  Copyright Steve Grubb

  Markup created by unroff 1.0, `` `` September 14, 2001.