triplot            package:TeachingDemos            R Documentation

_C_r_e_a_t_e _o_r _a_d_d _t_o _a _T_r_i_l_i_n_e_a_r _P_l_o_t

_D_e_s_c_r_i_p_t_i_o_n:

     Create (or add to) a trilinear plot of 3 proportions that sum to
     1.

_U_s_a_g_e:

     triplot(x, y = NULL, z = NULL, labels = dimnames(x)[[2]], txt =
     dimnames(x)[[1]], legend = NULL, legend.split = NULL, inner = TRUE, inner.col = c("lightblue", "pink"), inner.lty = c(2, 3), add = FALSE, main = "", ...)

_A_r_g_u_m_e_n_t_s:

       x: Vector or matrix of up to 3 columns. 

       y: Vector (if 'x' is a vector). 

       z: Vector (if 'x' is a vector). 

  labels: Labels for the 3 components (printed at corners). 

     txt: Vector of text strings to be plotted instead of points. 

  legend: Labels for the data points 

legend.split: What proportion of the labels will go on the left. 

   inner: Logical, should the inner reference lines be plotted. 

inner.col: Colors for the 2 inner triangles. 

inner.lty: Line types for the 2 inner triangles. 

     add: Add points to existing plot (TRUE), or create a new plot
          (FALSE). 

    main: Main title for the plot. 

     ...: Additional arguments passed on to 'points' or 'text'. 

_D_e_t_a_i_l_s:

     Trilinear plots are useful for visualizing membership in 3 groups
     by plotting sets of 3 proportions that sum to 1 within each set.

     The data can be passed to the function as a matrix with either 2
     or 3 columns, or as seperate vectors to 'x', 'y', and optionaly
     'z'.  If 2 columns are passed in, then they must be between 0 and
     1 and the 3rd column will be created by subtracting both from 1. 
     If 3 columns of data are given to the function then each will be
     divided by the sum of the 3 columns (they don't need to sum to 1
     before being passed in).

_V_a_l_u_e:

     An invisible matrix with 2 columns and the same number of rows as
     'x' corresponding to the points plotted (after transforming to 2
     dimensions).

     The return matrix can be passed to 'identify' for labeling of
     individual points.

     Using 'type='n'' and 'add=FALSE' will return the transformed
     points without doing any plotting.

_A_u_t_h_o_r(_s):

     Greg Snow greg.snow@intermountainmail.org

_R_e_f_e_r_e_n_c_e_s:

     Allen, Terry. Using and Interpreting the Trilinear Plot. Chance.
     15 (Summer 2002).

_S_e_e _A_l_s_o:

     'triangle.plot' in package ade4, 'ternaryplot' in package vcd,
     'tri' in package cwhtool, 'soil.texture' and 'triax.plot' in
     package plotrix.

_E_x_a_m_p_l_e_s:

     triplot(USArrests[c(1,4,2)])
     tmp <- triplot(USArrests[c(1,4,2)],txt=NULL)
     ## Not run:  identify(tmp, lab=rownames(USArrests) ) 

     tmp <- rbind( HairEyeColor[,,'Male'], HairEyeColor[,,'Female'])
     tmp[,3] <- tmp[,3] + tmp[,4]
     tmp <- tmp[,1:3]
     triplot(tmp, legend=rep(c('Male','Femal'),each=4),
      col=rep(c('black','brown','red','yellow'),2))

