to EOS Electronic Supplementto AGU Home Vol. 85, No. 16, 20 April 2004


New Freeware Makes Plotting and Analyzing Data Trends in Ternary Diagrams Easy


Cédric M. John, University of California, Santa Cruz


Copyright 2004 American Geophysical Union


Ternary plots are used to characterize a system based on three components. Triangular plotting is thus useful to a broad audience in the Earth sciences, and it has many applications in the fields of geochemistry, sedimentology, paleontology, and geophysics. Unfortunately, it is often only the most expensive commercial software packages that offer the option of plotting data in ternary diagrams. Moreover, these expensive programs frequently lack features that would be useful to geoscientists, such as the ability to plot data directly into a standardized diagram and to analyze temporal and stratigraphic trends within this diagram. Hence, even if the principles of plotting in a triangular diagram are not new, there was always a lack of software with an easy to use, modern, graphical user interface that would be available to the community at no cost.

Plot (pronounced "Delta Plot") was developed to address these concerns, with the Earth sciences community specifically in mind. Plot was programmed using Apple's Cocoa framework [Apple Computer, 2001; Anguish et al., 2003] and can thus be used on any Macintosh computer running Mac OS X. This article summarizes the principles implemented in the software to plot ternary data, and exposes the features and philosophy of Plot.

Computer Solution to Plotting Ternary Diagrams

In Plot, data sets consist of five columns and as many rows as there are data entries. Each data point is thus characterized by the three numerical values used for plotting (top value, lower left, and lower right values of the triangle), as well as an independent sorting value and a sample name. The sorting value is referred to as the "height/age" of the sample since these two parameters are frequently used in geosciences for trend analysis. However, the data set can be sorted using any set of independent numerical values. The three values for each pole of the diagram are then normalized to one, and the normalized values are referred here as tv (top value), llv (lower left value), and lrv (lower right value).

Each point can then be plotted using simple trigonometry. The difficulty is to represent a point defined by three parameters (llv, lrv, and tv) in a two-dimensional framework defined by X-Y coordinates and an origin centered at the lower left corner of the triangle (LL, see Figure 1). Expressing a point in this X-Y coordinate system is necessary to be able to plot it correctly on a computer screen. Yt is defined here as being the Y coordinate of a given point in the screen coordinate system, and Xt is defined as being the X coordinate of the point in the same system (Figure 1).

Fig. 1. This diagram shows how the X-Y coordinates are calculated from the ternary data in the software. See article for details.

The Yt component of a point P is easily calculated since it depends only on two variables that are known: the height, h, of the triangular plot and the value tv (Figure 1). One can then write:

Calculating the Xt component of the point is more tedious since it requires that the llv and the tv be defined properly. Since we are dealing with an equilateral triangle, the point P is also inscribed in an equilateral triangle LL-LL'-LR'. The height segment h' of this triangle is perpendicular to the LL'-LR' segment, and thus its length is linked to the llv value of point P and is linearly dependent on 1-llv. Hence, h' can be expressed by:

Following the rules in an equilateral triangle, the side a of the LL-LL'-LR' triangle can be calculated by:

We then can calculate the length of the segment P'-LR' by applying Pythagoras' theorem. To do this, we consider the angle lower case alpha in the P-P'-LR' triangle (Figure 1). Yt then represents the side opposite lower case alpha and the segment P'-LR' is adjacent to lower case alpha. Since lower case alpha has a value of 60° (Figure 1), we can write:

Finally, Xt is obtained by subtracting | p'-LR' | from a (see Figure 1):

Hence, each point P can be expressed in the X-Y frame by P(Xt,Yt), a mathematical solution implemented in the software.

Features Available in Plot 1.1.1

Importing and Working with Data

The interface in Plot 1.1.1 consists of two windows: a data window and a plot window (Figure 2). The software is not suited for typing in data series, so data must be imported either from a text file created using a spreadsheet program ("txt" file) or using copy-paste directly from the spreadsheet. The data for each column should be separated using the "Tab" character, and each data set is then separated from the other data sets by a carriage return sign after the fifth column. No blank lines should be included, but blank values separated by tabs are accepted and will be treated as "0" by the software, which might ultimately remove them from the data set depending on the filter options (see below). Word processors are generally not recommended for typing in data since they often end the line by a "paragraph end" symbol rather than a "carriage return." Spreadsheet programs such as Microsoft Excel are more appropriate. Any number of files can be imported, and each file will be automatically plotted in the same diagram as independent data sets. During the importation phase, data can be filtered to eliminate points that have 0 values in one or two of their columns or to import every point regardless of the nil values. The various plot parameters can also be assigned appropriate columns of the data set during the importation phase. Once the data is plotted, eight different symbols can be selected for the data points (Figure 2), as well as modifying the symbol size and selecting any color available on the computer.

Fig. 2. This graphical user interface (GUI) of Plot 1.1.1 shows (1) data window; (2) plot window; (3) list of data sets being plotted; (4) data for the currently selected data set; (5) currently selected ternary diagram in which the data are being plotted. In this case it is a blank diagram; (6) options for the plot. Note the two pop-up menus that are used to swap between plot library folders and select plots, respectively; (7) various options for the data point format. Note that you can change the shape, size, and color of the point. Sorting of the data set can be ascending or descending, and you can choose to apply a color gradient to display the sorting.

Working with Plots and the Plot Library

Once the data are imported, they are directly plotted in a blank ternary diagram. One of the biggest advantages of Plot over other ternary plotting software is that the blank diagram can be exchanged from within the software with virtually any standard diagram: it is simply a matter of one click! It is thus possible to browse through various triangular plots in the background to find the appropriate match to the data set. The data do not need to be re-plotted each time, and diagrams are simply selected using a combination of two pop-up menus (Figure 2). Furthermore, the originality of Plot is that it relies on a data base of standard diagrams stored externally to the software. The current library holds some 30 plots, but since the standard diagrams are simply PDF files stored in the application folder, a user can easily modify them using any drawing program supporting PDF. Hence, data can be plotted in virtually any existing diagram provided that the diagram was drawn once according to the Plot template and then placed into the library folder. Since the software is oriented toward the scientific community, exchanges of plots developed by Plot users are encouraged. Individuals willing to contribute their plots can do so by sending them to geosoft@crog.org, and they will be fully acknowledged in future releases of the software.

Once the diagram needed is selected, a grid can be plotted on top of it and several other graphical options can be modified. When the plotted series and the standard diagram are ready, they can be exported together as a single PDF file. The PDF files can then be further edited in third-party software if needed or be directly used in publications or presentations.

Analyzing Trends and Creating Sub-Series

As mentioned in the principle behind the software, Plot 1.1.1 uses an independent column of data to sort the data set. The sorting of the data can be graphically represented in two different ways. First, the center of each data point can be linked with an arrow to the center of the next point in the direction of sorting (ascending or descending). This can be particularly useful for visualizing trends in small data sets, such as the evolution of magmatic series or of a melt through time (Figure 3a). For larger data sets, this solution can prove unpractical. Instead, the color of the data point is used to reflect its position in the data set. Two colors are defined per data set: the initial color (corresponding to the first data point) and the final color (corresponding to the last data point). For each data point, the colors are then mixed in proportion of the position of the data point in the data set, creating a color gradient that reflects the order of sorting. In other words, the triangular plot can be seen as a two-dimensional diagram where the colors of the points add a third-dimensional component (Figure 3b, diagram by Oinuma et al. [1972]; data after John [2003]).

Fig. 3. Various options for displaying trends are shown. (A) In this imaginary case, few data points show the evolution of a melt through time. Data points are sorted according to age, and a green arrow displays the direction of the evolution. (B) Data from John [2003] are plotted in a ternary diagram for chlorite after Oinuma et al. [1972]. Since the data set is large, the trend is displayed by creating a color gradient. In this case, the deeper in the well the sample comes from, the higher the contribution of the chlorite peak at 14å.

Once trends are established, and if different groupings are identified, sub-series of the data set can be created. For this, the points needed are simply selected and the software can create a new data set based on this selection. Points coming from different data sets can also be merged into a single new data set. Data sets can then be exported as text files and be used in any other programs supporting this format.

Other Features

Plot 1.1.1 has numerous other features that make working in ternary diagrams easy. For instance, the software fully supports drag and drop: data files can be imported and PDF files exported simply by dragging and dropping the items. It is also possible to save the plots and data files together as a single Plot file, thus making future work on the data easier. Finally, Plot comes with a fully searchable help file as well as help by pointing (an explanation field appears when you point for a couple of seconds to an item in the user interface).

Requirements, License, and Future Releases of Plot

Plot 1.1.1 will run under any Macintosh equipped with Mac OS X 10.2 or a more recent version. The software might run under earlier versions of Mac OS X but was never tested for these systems, and problems might be encountered. Plot will not run under Mac OS 9.x or under Windows-based PC systems. Versions for these systems are not planned.

Plot 1.1.1 is released as freeware, and future releases of the software are planned to be freeware as well. The software can be downloaded at the following address: http://www.crog.org/dplot. The only requirement for users is to cite this Eos article in publications if Plot is used to produce illustrations and/or to perform data analysis.

Work is currently being carried on a newer version of Plot, version 2.0. The release date for this version is not known at the moment, but those interested can register on a user list at geosoft@crog.org. This list will not be published, distributed, or used for any purposes other than informing the members of the list about new Plot releases. Plot2.0 will focus on higher flexibility in the importation of the data, in new analysis tools, and improved user interface. Suggestions for the new release are welcome (geosoft@crog.org) and will generally be implemented if possible. Bug reports on any Plot versions are welcome at the above mentioned e-mail address.

Acknowledgments

Sidonie Wicky is thanked for helping to produce most of the PDF diagrams of Plot, and Renault John greatly improved the Plot Web site. Uwe Baaske and Nickolas Raterman also contributed several plots to the library. Last, but not least, I thank Eos editor, John Geissman, as well as Judy Jacobs and Jane Selverstone for their help in improving the manuscript and for providing interesting feedback for future releases of Plot.

References

Anguish, S.M., E. M. Buck, and D. A. Yacktman, (2003), Cocoa Programming, 1245 pp., SAMS Publishing, Indianapolis.
Apple Computer, I., (2001), Learning Cocoa, 366 pp., O'Reily and Associates, Inc., Sebastopol.
John, C. M., (2003), Miocene climate as recorded on slope carbonates: Examples from Malta (Central Mediterranean) and Northeastern Australia (Marion Plateau, ODP LEG 194), Ph.D. thesis, 90 pp., University of Potsdam, Germany, published online at http://pub.ub.uni-potsdam.de/2003meta/0023/door.htm.
Oinuma, K., S. Shimoda, and T. Sudo, (1972), Triangular diagrams of surveying chemical compositions of chlorites, J. Tokyo Univ., 78, 2, 1-13.


AGU