Plots 3-part compositional data within a barycentric triangle (S.J. Clark).

### Options

`PRINT` = text |
What to print (`proportions` ); default `*` |
---|---|

`VERTEXLABELS` = text |
Labels for the vertices of the triangle; default * uses the names of the corresponding variates given in the `DATA` pointer |

`TITLE` = text |
Title for the barycentric triangle; default `*` (i.e. no title) |

`PERPENDICULARS` = text |
Whether to draw perpendiculars from each vertex to its opposite side (`yes` , `no` ); default `no` |

`WINDOW` = number |
Which high-resolution graphics window to use; default 3 |

`SCREEN` = string token |
Whether to clear the graphics screen before plotting (`clear` , `keep` ); default `clea` |

### Parameters

`DATA` = pointers |
Contains variates which form the three-part compositions |
---|---|

`SCALE` = scalars |
Scale factor for adjusting size of triangle to represent a fourth category; default 1 |

`SAVECOORDINATES` = pointers |
Saves the two-dimensional x- and y-coordinates into the first and second elements of the pointer, respectively |

`PEN` = scalars or variates or factors |
Pen number to draw points within the barycentric triangle; default 1 |

### Description

`DCOMPOSITIONAL`

plots three-part compositional data within a barycentric triangle (ternary diagram). Four-part compositional data can be represented when there is only one experimental unit.

Compositional data consist of vectors of proportions (one for each experimental unit). Each vector contains a set of *d* non-negative elements, each element representing a proportion of some whole, with the sum of the elements constrained to unity (Aitchison 1986). A composition with *d* elements per vector is termed a *d*-part composition. `DCOMPOSITIONAL`

produces a graphical display of three-part compositions within an equilateral triangle with unit height (termed a barycentric triangle or ternary diagram), using high-resolution graphics. The three parts of the compositions are input using the `DATA`

parameter as a pointer containing three separate variates. The first, second and third variates in the pointer should correspond, respectively, to the parts required to be represented at the top, bottom left and bottom right vertices of the triangle. `DCOMPOSITIONAL`

also allows for data to be input on an original scale, in which case they will be converted to proportions of the totals. Variates representing the two-dimensional x- and y-coordinates can be saved (in a pointer) using the `SAVECOORDINATES`

parameter. The `PEN`

parameter may be used to specify the pen to use to plot the points within the barycentric triangle; the default setting is pen 1 (for which the initial defaults are `METHOD=point`

and `SYMBOLS=1`

).

The `SCALE`

parameter should be set only when there is a single experimental unit (i.e. the length of each variate in the `DATA`

pointer is one) and is provided to aid representation of a four-part composition. Its value, which should equal the sum of three of the parts divided by the total of all four parts, is used to scale the overall size of the triangle; by default `SCALE`

is 1. The three parts in the numerator should be input using the `DATA`

parameter, and the point plotted within the scaled triangle therefore represents the relative proportions of the three parts amongst themselves. This option is most useful when plotting several triangles in different windows of the same frame.

The proportions can be printed by setting option `PRINT=proportions`

. Labels for the vertices of the triangle can be specified by setting the `VERTEXLABELS`

option to a text structure containing exactly three values: the first, second and third values should correspond, respectively, to the labels required at the top, bottom left and bottom right vertices of the triangle. By default the vertices will be labelled by the names of the corresponding variates given in the `DATA`

pointer. The perpendiculars from each vertex to its opposite side will be drawn (using `LINESTYLE=2`

) if the `PERPENDICULARS`

option is set to yes; otherwise these lines are omitted. The graphical display can be controlled as usual using the `TITLE`

, `WINDOW`

and `SCREEN`

options. By default triangles are produced in window 3, have no title, and are drawn on a new screen.

Options: `PRINT`

, `VERTEXLABELS`

, `TITLE`

, `PERPENDICULARS`

, `WINDOW`

, `SCREEN`

.

Parameters: `DATA`

, `SCALE`

, `SAVECOORDINATES`

, `PEN`

.

### Method

The percentages of the totals are computed within the procedure (when proportions are input this will therefore have no effect), and standard graphics commands are used to produce high-quality graphical output.

### Action with `RESTRICT`

If the variates input by the `DATA`

parameter are restricted, only the selected points are plotted.

### Reference

Aitchison, J. (1986) *The statistical Analysis of Compositional Data*. Chapman & Hall, London.

### See also

Directive: `DPIE`

.

Commands for: Graphics.

### Example

CAPTION 'DCOMPOSITIONAL example',\ !t('Compositions (sand, silt, clay) of 39 sediment samples.',\ 'Data set 5 from Aitchison (1986, The Statistical Analysis',\ 'of Compositional Data. Chapman & Hall, London. Page 359',\ 'and Figure 1.2 page 6).'); STYLE=meta,plain VARIATE [NVALUES=39] sand,silt,clay READ [SERIAL=yes] sand,silt,clay 77.5 71.9 50.7 52.2 70.0 66.5 43.1 53.4 15.5 31.7 65.7 70.4 17.4 10.6 38.2 10.8 18.4 4.6 15.6 31.9 9.5 17.1 10.5 4.8 2.6 11.4 6.7 6.9 4.0 7.4 4.8 4.5 6.6 6.7 7.4 6.0 6.3 2.5 2.0 : 19.5 24.9 36.1 40.9 26.5 32.2 55.3 36.8 54.4 41.5 27.8 29.0 53.6 69.8 43.1 52.7 50.7 47.4 50.4 45.1 53.5 48.0 55.4 54.7 45.2 52.7 46.9 49.7 44.9 51.6 49.5 48.5 52.1 47.3 45.6 48.9 53.8 48.0 47.8 : 3.0 3.2 13.2 6.6 3.5 1.3 1.6 9.8 30.1 26.8 6.5 0.6 29.0 19.6 18.7 36.5 30.9 48.0 34.0 23.0 37.0 34.9 34.1 41.0 52.2 35.9 46.4 43.4 51.1 40.9 45.7 47.0 41.3 45.9 46.9 45.1 39.9 49.5 50.2 : POINTER [NVALUES=3] part; VALUES=!p(sand,silt,clay) FACTOR [LEVELS=5; VALUES=13(1),11(2),5(3),6(4),4(5)] depth TEXT [VALUES=Sand,Silt,Clay] sediment DCOMPOSITIONAL [PRINT=proportions; VERTEXLABELS=sediment; PERPENDICULARS=yes;\ TITLE='Sediment samples from an Arctic lake']\ part; SAVECOORDINATES=coord PRINT coord[] PEN 10; SYMBOLS=depth; METHOD=point; COLOUR='black' DCOMPOSITIONAL [TITLE='Sediment samples from an Arctic lake by depth']\ part; PEN=10 VARIATE [NVALUES=1] data1[1...4]; VALUES=3,5,2,10 VARIATE [NVALUES=1] data2[1...4]; VALUES=13,8,22,9 CALCULATE total1 = VSUM(data1) CALCULATE total2 = VSUM(data2) SCALAR size1,size2 CALCULATE size1 = VSUM(!p(data1[1...3])) / total1 CALCULATE size2 = VSUM(!p(data2[1...3])) / total2 DCOMPOSITIONAL [WINDOW=5] !p(data1[1...3]); SCALE=size1 DCOMPOSITIONAL [WINDOW=6; SCREEN=keep] !p(data2[1...3]); SCALE=size2