1. Home
  2. DERRORBAR procedure

DERRORBAR procedure

Adds error bars to a graph (R.W. Payne).

Options

ORIENTATION = string token Direction of the line (horizontal, vertical); default vert
BARCAPWIDTH = scalars Width of the cap drawn at the ends of the error bar; default 1
WINDOW = scalar Window in which to draw the bar; default 1
KEYWINDOW = scalar Window number for the key (zero for no key); default 2

Parameters

BARLENGTH = scalars Lengths of the bars
Y = identifiers Vertical coordinates for the midpoints of the bars
X = identifiers Horizontal coordinates for the midpoints of the bars
PEN = scalars Pen to use for each bar
LABEL = texts Text to plot alongside each bar
YLPOSITION = string tokens Position of each label in the y-direction (above, below, centre, center); default belo
XLPOSITION = string tokens Position of each label in the x-direction (centre, center, left, right); default righ
PENLABEL = scalars Pen to use for each label
DESCRIPTION = texts Annotation for the key

Description

The DERRORBAR procedure plots error bars on a graph. The window containing the graph is specified by the WINDOW option (default 1). The ORIENTATION option controls whether the bars are horizontal (i.e. parallel to the x-axis) or vertical (i.e. parallel to the y-axis).

The BARLENGTH parameter defines the length of each bar, on the y-axis for a vertical line, or the x-axis for a horizontal line. The positions of their midpoints are specified by the Y and X parameters. If these are not set, a vertical bar will be plotted just inside the left-hand side of the window, and a horizontal bar will be plotted at the bottom of the window. The PEN parameter can specify the pen to use for each bar. If this is not set, pen 255 is used as a default, having first been defined to draw continuous black lines. The BARCAPWIDTH option specifies the size of the “caps” drawn at the ends of the bars.

The LABEL parameter allows you to plot a label alongside each bar. 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.

The DESCRIPTION parameter can supply annotation to add to the key for each bar. The window for the key is specified by the KEYWINDOW option (default 2).

Options: ORIENTATION, BARCAPWIDTH, WINDOW, KEYWINDOW.
Parameters: BARLENGTH, Y, X, PEN, LABEL, YLPOSITION, XLPOSITION, PENLABEL, DESCRIPTION.

See also

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

Example

CAPTION   'DERRORBAR example'; STYLE=meta
SPLOAD    [PRINT=*] '%GENDIR%/Data/Sulphur.gsh'
PEN       4; SYMBOL='circle'
DGRAPH    Sulphur; Windsp; pen=4
CALCULATE sd = SQRT(VARIANCE(Sulphur))
DERRORBAR sd; Y=sd/2; PEN=2; DESCRIPTION='Standard deviation'
Updated on September 11, 2019

Was this article helpful?