Learn R Programming

compositions (version 2.0-2)

biplot3D: Three-dimensional biplots, based on package rgl

Description

Plots variables and cases in the same plot, based on a principal component analysis.

Usage

biplot3D(x,...)
# S3 method for default
biplot3D(x,y,var.axes=TRUE,col=c("green","red"),cex=c(2,2),
            xlabs = NULL, ylabs = NULL, expand = 1,arrow.len = 0.1,
            ...,add=FALSE)
 # S3 method for princomp
biplot3D(x,choices=1:3,scale=1,...,
            comp.col=1,comp.labs=paste("Comp.",1:3),
            scale.scores=lambda[choices]^(1-scale),
            scale.var=scale.comp, scale.comp=sqrt(lambda[choices]), 
            scale.disp=1/scale.comp)

Arguments

x

princomp object or matrix of point locations to be drawn (typically, cases)

choices

Which principal components should be used?

scale

a scaling parameter like in biplot

scale.scores

a vector giving the scaling applied to the scores

scale.var

a vector giving the scaling applied to the variables

scale.comp

a vector giving the scaling applied to the unit length of each component

scale.disp

a vector giving the scaling of the display in the directions of the components

comp.col

color to draw the axes of the components, defaults to black

comp.labs

labels for the components

further plotting parameters as defined in rgl::rgl.material

y

matrix of second point/arrow-head locations (typically, variables)

var.axes

logical, TRUE draws arrows and FALSE points for y

col

vector/list of two elements the first giving the color/colors for the first data set and the second giving color/colors for the second data set.

cex

vector/list of two elements the first giving the size for the first data set and the second giving size for the second data set.

xlabs

labels to be plotted at x-locations

ylabs

labels to be plotted at y-locations

expand

the relative expansion of the y data set with respect to x

arrow.len

The length of the arrows as defined in arrows3D

add

logical, adding to existing plot or making a new one?

Value

the 3D plotting coordinates of the tips of the arrows of the variables displayed, returned invisibly

Details

This "biplot" is a triplot, relating data, variables and principal components. The relative scaling of the components is still experimental, meant to mimic the behavior of classical biplots.

See Also

gsi

Examples

Run this code
# NOT RUN {
data(SimulatedAmounts)
pc <- princomp(acomp(sa.lognormals5))
pc
summary(pc)
plot(pc)      #plot(pc,type="screeplot")
biplot(pc)
if(requireNamespace("rgl", quietly = TRUE)) {
  biplot3D(pc)
} ## this function requires package 'rgl'

# }

Run the code above in your browser using DataLab