1. Home
  2. DREFERENCELINE procedure

DREFERENCELINE procedure

Adds reference lines to a graph (R.W. Payne).

Options

ORIENTATION = string token Direction of the line (horizontal, vertical); default hori
WINDOW = scalar Window in which to draw the line; default 1

Parameters

POSITION = scalars Positions of the lines
PEN = scalars Pen to use for each line
LABEL = texts Text to plot alongside each line
YLPOSITION = string tokens Position of the label in the y-direction (above, below, centre, center); default belo
XLPOSITION = string tokens Position of the label in the x-direction (centre, center, left, right); default left
PENLABEL = scalars Pen to use for each label

Description

The DREFERENCELINE procedure adds reference lines to a plot. The window containing the plot is specified by the WINDOW option. The ORIENTATION option controls whether the lines are horizontal (i.e. parallel to the x-axis) or vertical (i.e. parallel to the y-axis).

The POSITION parameter defines the position of each line, on the y-axis for a horizontal line, or the x-axis for a vertical line. The PEN parameter can specify the pen to use for the line. If this is not set, pen 255 is used as a default, having first been defined to draw continuous light grey lines in 0.75 thickness.

The LABEL parameter lets you plot a label inside the frame, alongside the line. Its position is specified by the YLPOSITION and XLPOSITION parameters. The pen to use can be specified by the PENLABEL parameter. If this is not set, pen 256 is used as a default, having first been defined to omit any symbol and use the colour black.

Options: ORIENTATION, WINDOW.

Parameters: POSITION, PEN, LABEL, YLPOSITION, XLPOSITION, PENLABEL.

See also

Procedures: DARROW, DERRORBAR, DFRTEXT, DTEXT.
Commands for: Graphics.

Example

CAPTION        'DREFERENCELINE example'; STYLE=meta
SPLOAD         [PRINT=*] '%GENDIR%/Data/Iris.gsh'
PEN            1; SYMBOL='smallcircle';   CSYMBOL='blue'; CFILL='blue'
DGRAPH         Petal_Length; Petal_Width
CALCULATE      mpl,mpw = MEAN(Petal_Length,Petal_Width)
PEN            2,3; CLINE='cyan'; CSYMBOL='purple'
DREFERENCELINE [ORIENTATION=horizontal] mpl; LABEL='Mean length';\
               PEN=2; PENLABEL=3
DREFERENCELINE [ORIENTATION=vertical] mpw; LABEL='Mean width';\
               PEN=2; PENLABEL=3
Updated on September 2, 2019

Was this article helpful?