Learn R Programming

compositions (version 1.40-2)

kingTetrahedron: Ploting composition into rotable tetrahedron

Description

Plots acomp/rcomp objects into tetrahedron exported in kinemage format.

Usage

kingTetrahedron(X, parts=1:4, file="tmptetrahedron.kin",
   clu=NULL,vec=NULL, king=TRUE, scale=0.2, col=1, 
   title="Compositional Tetrahedron")

Arguments

X

a compositional acomp or rcomp object of 4 or more parts

parts

a numeric or character vector specifying the 4 parts to be used.

file

file.kin for 3D display with the KiNG (Kinemage, Next Generation) interactive system for three-dimensional vector graphics.

clu

partition determining the colors of points

vec

vector of values determining points sizes

king

FALSE for Mage; TRUE for King (described below)

scale

relative size of points

col

color of points if clu=NULL

title

The title of the plot

Value

The function is called for its side effect of generating a file for 3D display with the KiNG (Kinemage, Next Generation) interactive system for three-dimensional vector graphics. Works only with KiNG viewer available at http://kinemage.biochem.duke.edu

Details

The routine transforms a 4 parts mixture m quadrays into 3-dimensional XYZ coordinates and writes them as file.kin. For this transformation we apply K. Urner: Quadrays and XYZ at http://www.grunch.net/synergetics/quadxyz.html. The kin file we display as 3-D animation with KiNG viewer a free software available at http://kinemage.biochem.duke.edu. A kinemage is a dynamic, 3-D illustration. The best way to take advantage of that is by rotating it and twisting it around with the mouse click near the center of the graphics window and slowly draging right or left, up or down. Furthermore by clicking on points with the mouse (left button again), the label associated with each point will appear in the bottom left of the graphics area and also the distance from this point to the last will be displayed. With the right button drag we can zoom in and out of the picture. This animation supports coloring and different sizing of points.

We can display the kin file as 3-D animation also with MAGE viewer a previous version of KiNG, also a free software available at http://kinemage.biochem.duke.edu. For this one has to put king=FALSE as a parameter.

References

Aitchison, J. (1986) The Statistical Analysis of Compositional Data Monographs on Statistics and Applied Probability. Chapman & Hall Ltd., London (UK). 416p.

http://vlado.fmf.uni-lj.si/pub/MixeR/

http://www.grunch.net/synergetics/quadxyz.html

See Also

plot.acomp

Examples

Run this code
# NOT RUN {
data(SimulatedAmounts)
dat <- acomp(sa.groups5)
hc <- hclust(dist(dat), method = "complete")  # data are clustered 
kingTetrahedron(dat,parts=1:4, file="myfirst.kin", clu=cutree(hc,7),
scale=0.2)
# the 3-D plot is written into Glac1.kin file to be displayed with KiNG viewer. 
# The seven clusters partition is notated with different colors of points.
# }

Run the code above in your browser using DataLab