Learn R Programming

compositions (version 2.0-1)

plot3Dacomp: 3D-plot of compositional data

Description

3D-plot of compositional data. The plot is mainly an exploratory tool, not intended for exact display of data.

Usage

# S3 method for acomp
plot3D(x, parts=1:min(ncol(X),4),..., 
             lwd=2, axis.col="gray", add=FALSE, cex=2, 
             vlabs=colnames(x), vlabs.col=axis.col, center=FALSE, 
             scale=FALSE, log=FALSE, bbox=FALSE, axes=TRUE, size=cex,col=1)
# S3 method for rcomp
plot3D(x,parts=1:min(ncol(X),4),...,
             lwd=2,axis.col="gray",add=FALSE,cex=2,
             vlabs=colnames(x),vlabs.col=axis.col,center=FALSE,
             scale=FALSE,log=FALSE,bbox=FALSE,axes=TRUE,size=cex,col=1)

Arguments

x

an aplus object to be plotted

parts

a numeric xor character vector of length 3 coding the columns to be plotted

additional plotting parameters as described in rgl::rgl.material

add

logical, adding or new plot

cex

size of the plotting symbols

lwd

line width

axis.col

color of the axis

vlabs

the column names to be plotted, if missing defaults to the column names of the selected columns of X

vlabs.col

color of the labels

center

logical, should the data be centered

scale

logical, should the data be scaled

log

logical, indicating wether to plot in log scale

bbox

logical, whether to add a bounding box

axes

logical, whether plot a coordinate cross

size

size of the plotting symbols

col

the color used for dots, defaults to black.

Value

Called for its side effect of a 3D plot of an acomp object in an rgl plot. It invisibly returns the 3D plotting coordinates of the objects displayed

Details

The routine behaves different when 3 or four components should be plotted. In case of four components:

If log is TRUE the data is plotted in ilr coordinates. This is the isometric view of the data.

If log is FALSE the data is plotted in ipt coordinates and a tetrahedron is plotted around it if coors == TRUE. This can be used to do a tetrahedron plot.

In case of three components:

If log is TRUE the data is plotted in clr coordinates. This can be used to visualize the clr plane.

If log is FALSE the data is plotted as is, showing the embedding of the three-part simplex in the three-dimensional space.

In all cases: If coors is true, coordinate arrows are plotted of length 1 in the origin of the space, except in the tetrahedron case.

See Also

kingTetrahedron rgl::points3d, graphics::plot, plot3D, plot3D.rmult,

plot3D.rcomp, plot3D.aplus,plot3D.rplus

Examples

Run this code
# NOT RUN {
data(SimulatedAmounts)
if(requireNamespace("rgl", quietly = TRUE)) {
  plot3D(acomp(sa.lognormals5),1:3,col="green")
  plot3D(acomp(sa.lognormals5),1:3,log=TRUE,col="green")
  plot3D(acomp(sa.lognormals5),1:4,col="green")
  plot3D(acomp(sa.lognormals5),1:4,log=TRUE,col="green")
} ## this function requires package 'rgl'
# }

Run the code above in your browser using DataLab