## E. - Writing User Functions

Rules for writing type 1 to 4

**C-PLOT**user functions are explained in this appendix. Rules for writing type 5 user functions, the fits, are discussed in the second half of Chapter 12.

For type 1 user functions, you provide a routine to produce values for the dependent variable

*y*as a function of the independent variable

*x*. The values of

*x*passed to your routine are determined by the ranges you enter with the

`fn`

command.
The
values for
*x*error bars,

*y*error bars and

*z*are set to 0. Type 1 users functions are not useful in 3D mode. In type 2 user functions, you provide routines to produce values for all four

**C-PLOT**variables,

*x*,

*y*,

*r*and

*s*in 2D mode and

*x*,

*y*,

*z*and

*s*in 3D mode, as a function of the parametric variable whose range you also supply with the

`fn`

command.
For type 3 user functions,
no range information is used.
Instead, you provide routines to calculate
new values for the four variables based on their current values.
For the first three types of user functions, you provide routines to calculate values for a single data point coordinate at a time. These routines are repeatedly called by the overhead module routines. With type 4 user functions, the overhead module makes one call to the routine you provide. You supply the code necessary to create or modify the entire data set.

With each of these four types of user functions, you can set many of the display options for the plot, including the title, labels, symbol, key and axis ranges. Each of these user function requires you to provide a routine named

`setup()`

that will be called
once.
For type 1 to 3 user functions, this is where the display options
would be set.
- E.1. - Compiling user functions