## S-plot guide

This program produces X or postscript plots of the points (models) in parameter space
generated by a neighbourhood algorithm. It reads the models from the NAD direct access file
produced by the program *NA-sampler* and plots the scatter of points projected on to planes
defined by selected pairs of variables.

**To compile** type

`> make all`

in splot home directory. Note that splot is compiled automatically when `make all' is typed in the main src directory. The executables are placed in the bin directory.

To execute type

`splot-x`(or splot-p) (-g)

for X, or Postscript in the `data/splot` directory.

The `-g` is optional, and produces a discretized version of the plot, rather than
plotting each model as a coloured dot. This is useful if the number of models (dots) is
large (e.g. > 15000). The discretization interval is controlled by the dot radius obtained
from splot.cmd.

The discretized version is much quicker in X and produces much smaller postscript files. The disadvantage is that one can no longer see the chronological progression of the sampling on the screen, which can give a useful impression of how the sampling varies as a function of iteration.

Note that on some machines the X-graphics version has been known to crash if netscape is running due of a conflict in colour tables.

**Input files:**

*na.nad*- NAD format direct access file containing the multidimensional points (models) to be plotted. (Must be present.) The NAD format stands for neighbourhood algorithm direct access file, and is described here.*splot.cmd*- contains main control parameters for plot. (Must be present.) (See example file for explanation of entries.)*ranges.in*- contains upper and lower limits for each parameter, and other parameters which control appearance of axes. (Must be present.) (See example file for explanation of entries.)*pal.in*- defines colour of pens in RGB (must be present). (See example file for explanation of entries.)*model.ref*- defines a reference model to be plotted on top of scatter (optional file). A reference model is not plotted if model.ref is not present, or the pen colour for the reference model read in from splot.cmd is < 0.*finetune*- contains increments in cm for nudging the axes annotation and labels in a postscript plot. The file is optional and is only read in by postscript version splot-p. (See example file for details.)

**Output files:**

*splot.ps*- Postscript file of plot (only if splot-p is used).

splot-x sends plot to screen.

### Examples

An example NAD file is provided which has 10020 models in a 24-dimensional space. Example splot.cmd files are provided in directory splot/cmds which produce plots of 1,2,3,4,6,12,20, and 30 pairs of scatter plots in separate panels. To run any one, say the 2-panel plot, then do the following,

`cd data/splot``cp cmds/splot.cmd2 splot.cmd``splot-x`

This will produce the following plot.

The models are colour coded by the data fit using the colour scheme defined in file
*pal.in*.

A similar 6-panel plot can be obtained with

`cp cmds/splot.cmd6 splot.cmd``splot-x`

which gives

The input file for the 2-panel plot looks like this:

- #
- # Command file for program splot
- #
- na.nad : name of input nad file
- 2 : number of plots
- 13,17 : x,y variables for first plot (x=0 gives a plot of y vs iteration)
- 15,10 : x,y variables for next plot (x=0 gives a plot of y vs iteration)
- 3 : pen for true model symbol
- 4 : pen for best model symbol
- 0. 70. 0.0 : min, max, isw [Minimum and maximum percentiles (isw=0) or misfit (isw=1) for colour map]
- 21 40 : First and last pen for colourmap
- Title : Title string goes here
- 4. 16. 1.0 1.0 : x, y, size of title text for PS, X (These are multiplication factors of the default size)
- 1.0 1.0 : Size of text for PS, X (These are multiplication factors of the default size)
- 1.0 : Size of symbols (x default size)
- 1.0 : Size of model dots (x default size)
- 2 : Frame type (0=simple frame; 1=frame with max and min only;
- 2=annotated frame with options read from ranges.in)

Note that a pair of variables must be specified (1 pair per line) for each panel in the plot. If the x variable is set to zero then the y variable is plotted against the model number. This type of plot shows the degree to which the sampling on each variable narrows during the course of the sampling. Here is an example.

Three types of frame are possible and are controlled by the parameter on the last line.
If frametyp = 0 then each frame is a simple box with no annotation; = 1 then maximum and
minimum labels are added to each axis; = 2 and a fully annotated frame is produced using
variables read in from file *ranges.in*. (See example files for details of annotation
parameters.)

The file *finetune* can be used to adjust the position of the two axes labels and
numbers in the postscript plot (See example files for details). This will usually be
necessary to produce presentable postscript figures.

### References:

The Neighbourhood algorithm for searching a multi-dimensional parameter space for models (points) with `acceptable data fit' is implemented in the program NA-sampler, and is described in the paper:

*Geophysical Inversion with a Neighbourhood Algorithm -I. Searching a parameter space*, Sambridge, M.,*Geophys. J. Int.*,**138**, 479-494, 1999. doi:10.1046/j.1365-246X.1999.00876.x

A related paper describes the Neighbourhood re-sampling algorithm
(implemented in program *NA-bayes*) for calculating Bayesian integrals from a finite
set of samples produced by the NA algorithm or any other search method (e.g. GA or SA etc.):

*Geophysical Inversion with a Neighbourhood Algorithm -II. Appraising the ensemble*,Sambridge, M.,*Geophys. J. Int.*,**138**,727-746, 1999. doi:10.1046/j.1365-246x.1999.00900.x

**Related sites:**

NA homepage - where the latest versions of NA-Bayes and NA-sampler can be accessed.

NA-sampler - the latest version of this manual.

NAD - explanation of direct access nad files.

RFI - Receiver function utility programs and graphics (included with

*NA-Sampler*package.)NA-Bayes - the manual for the neighbourhood algorithm Bayesian inference package.

naplot - graphics program for displaying Bayesian estimators (included with

*NA-Bayes*package).summary.pdf - A short summary of NA-sampler written for the IASPEI handbook (PDF file)