[ Home ]

tetra2xyz is a tiny program to convert four-component non-independent data into Cartesian 3-space co-ordinates.

Image:  wasp population data from across Europe - courtesy of Rachel Atkinson.

Description :

If you have data that represent proportions that four components of a system that contribute to a total, then you may find tetra2xyz a useful tool. For example when dealing with metamorphic rocks containing four components, how can we graphically represent mixtures of those four components ?  Traditionally, this problem has been overcome by projection with only shows a particular subset of the whole system onto a three component ternary diagram. However, using this program is is possible to represent systems of four components, such as CaO-MgO-SiO2-H20 as points within a tetrahedral space.

In fact the program was developed to transform four component data representing wasp populations for a biologist friend- so its uses are widespread. The information used to make the program was gleaned from a series of on-line articles gathered together under the title of The Quadray Papers, which deal with four-dimensional simpicial co-ordinate systems, such as those of the tetrahedron.

The program reads in a four-column text file (with columns separated by white space) where each column contains the proportion of each component, which must sum to unity. The output of the program is a new text file containing three xyz co-ordinates, which will enable plotting of the data in a normal 3-D graphing application.

Example usage :

perl tetra2xyz.pl abcd.dat > xyz.dat

Licensing :

There isn't any! tetra2xyz is public domain software, and as such you may give it away and modify it to your requirements without seeking permission. As such it is supplied without warranty and no guarantee of fitness-for-purpose.


The program is written in a language called Perl and as such you will need a Perl interpreter to run it. If you're using Unix or GNU/Linux then you almost certainly have it already. You can get a free version for Windows from ActiveState.

Download :

Internet links :

Last updated 2001-10-05 R J Smallshire