Macro Language

Introduction

There are ~ 230 commands, ~55 math functions and ~90 constants available in the Plot macro language. Most of the commands need one or more argument. Simply enter the command followed by the arguments separated by spaces. Multiple commands in one line must be separated with :. If an argument contains spaces you have to quote the argument with ' or ". Comments can be escaped with #. For example a command may look like this:

atext xb 'Axis Text'
clr: list: exit

This command sets the axis text label for the first (bottom) X axis.

Note: some macro commands does not fully work with the Plot2 version from the AppStore. Use the download version instead.
http://apps.micw.org/apps/plot2/downloads.php

Variables

During macro execution several variables are available. String variable starts with a $ sign.

cbnumber of the current working buffer in the document
$datethe current date
$documentthe filename of the current document
dx1the distance between the last two measures with the mouse (1. X axis)
dx2the distance between the last two measures with the mouse (2. X axis)
dy1the distance between the last two measures with the mouse (1. Y axis)
dy2the distance between the last two measures with the mouse (2. Y axis)
$filethe filename from the browse command
framebottomthe position of bottom frame line
frameleftthe position of left frame line
framerightthe position of right frame line
frametopthe position of top frame line
framewidththe width of the frame
$homethe users home directory
inputthe result of the last input command
$inputthe result of the last input command as string
integralthe result from the last calcint command
lthe run variable for loops
lxthe X value during a data loop
lythe Y value during a data loop
lxethe X error value during a data loop
lyethe X error value during a data loop
lastbufferthe number of the last buffer generated by one of the calculation commands
marginbottomthe bottom margin
marginleftthe left margin
marginrightthe right margin
margintopthe top margin
nbnumber of data buffer in the document
optionthe result of the askoption command
ref1the 1. reference value
ref2the 2. reference value
linbga, linbgbthe reference values for linear background subtraction
rega, regb, regrthe result of the last regression
textheightthe height of the last added text
textwidththe width of the last added text
$timethe current time
$userthe user name
viewheightthe height of the current view
viewwidththe width of the current view
windowheightthe window height
windowwidththe window width
xpos1the last result of the measure with the mouse (1. X axis)
xpos2the last result of the measure with the mouse (2. X axis)
ypos1the last result of the measure with the mouse (1. Y axis)
ypos2the last result of the measure with the mouse (2. Y axis)
xmin1min value of the 1. (bottom) X axis
xmax1max value of the 1. (bottom) X axis
ymin1min value of the 1. (left) Y axis
ymax1max value of the 1. (left) Y axis
xmin2min value of the 2. (top) X axis
xmax2max value of the 2. (top) X axis
ymin2min value of the 2. (right) Y axis
ymax2max value of the 2. (right) Y axis
utthe number of seconds from the reference date (00:00:00 UTC on 1 January 1970), aka unix timestamp
mtthe number of seconds from the absolute reference date (00:00:00 UTC on 1 January 2001)

Arguments

In the command descriptions on the following pages optional argument is written with surround square brackets ([argument]) and required arguments with angle brackets (<argument>).

There are also some special arguments:


<BUFFER>

a list of one or more data buffers. Possible values are:

allall buffers in the document
selectedselected buffers in the document
unselectedunselected buffers in the document
visiblevisible buffers in the document
hiddenhidden buffers in the document
noneno buffer
b1,b2,b3,...,bna list of buffers where the arguments may be math expressions.
bs..bebuffers from bs to be

<AXIS>

A definition of the four axis. Possible values are:

allall four axis
xboth X axis
yboth Y axis
1, x1, xb, bottom1. X axis (bottom)
2, y1, yl, left1. Y axis (left)
3, x2, xt, top2. X axis (top)
4, y2, yr, right2. Y axis (right)

<AXISGROUP>

The coordinates system:

0, bothboth axis
1, firstfirst axis (left and bottom)
2, secondsecond axis (right and top)

<COOR>

The coordinates system:

0, screenscreen coordinates
1, firstfirst axis (left and bottom)
2, secondsecond axis (right and top)

<RANGE>

A list of numbers (e.g. used for the loop command):

ndefines a range from 0 to n
from:to:stepdefines a range where the arguments may be math expressions.
b1,b2,b3,...,bna list of numbers where the arguments may be math expressions.
bs..benumbers from bs to be

<COLOR>

This can be a hexadecimal color definition in the format RGB, ARGB, RRGGBB or AARRGGBB where R is red, G is green, B is blue and A is alpha.

There are also named colors which can be used: black, white, red, green, blue, orange, yellow, magenta, cyan, aluminum, aqua, asparagus, banana, blueberry, bubblegum, cantaloupe, carnation, cayenne, clover, eggplant, fern, flora, grape, honeydew, ice, iron, lavender, lead, lemon, licorice, lime, magnesium, maraschino, maroon, mercury, midnight, mocha, moss, nickel, ocean, orchid, plum, salmon, seafoam, silver, sky, snow, spindrift, spring, steel, strawberry, tangerine, teal, tin, tungsten, turquoise

The Plot default colors can be addressed with the numbers 0-15