Learn R Programming

pca3d (version 0.1)

pca3d-package: Show a three-dimensional plot of a prcomp object

Description

Show a three-dimensional plot of a prcomp object or a matrix, using different symbols and colors for groups of data

Usage

pca3d(pca, components = 1:3, col = "grey", title = NULL, offset = 50, new = FALSE, 
  axes.color = "black", bg = "white", radius = NULL, 
  group = NULL, shape = "sphere", show.scale = FALSE, 
  show.labels = FALSE, labels.col = "black", show.axes = T, 
  show.axe.titles = T, show.plane = T, show.shades = F, show.centroids = F)

Arguments

pca
Either a prcomp object or a matrix with at least three columns
components
Vector of length 3 containing the components to be shown
col
Either a single value or a vector of length equal to number of rows, containing color definitions for the plot points to be shown
title
Window title
offset
offset
new
Use TRUE to open a new window
axes.color
Axis color
bg
Background color
radius
Scaling item for the size of points to be shown
group
either NULL or a factor of length equal to number of rows. Factor levels can be used to automatically generate symbols and colors for the points shown
shape
Either a single value or a character vector describing the shapes to be used when drawing data points. Allowed shapes are: sphere, tetrahaedron and cube, and may be abbreviated.
show.scale
TRUE for showing a numeric scale at the edges of the plot.
show.labels
TRUE for showing labels (taken from the coordinate matrix or the prcomp object). Alternatively, a vector with labels to be shown next to the data points.
labels.col
Single value or vector describing the colors of the labels.
show.axes
TRUE to show the axes.
show.axe.titles
If TRUE, show axe titles (PC 1, PC 2 etc.)
show.plane
If TRUE, show a grey horizontal plane at y = 0
show.shades
If TRUE, show a "lollipop" representation of the points on the y = 0 plane: a vertical line joining the data point with the plane and a shadow.
show.centroids
If TRUE and the group variable is defined, show cluster centroids (using apropriate group symbols) and lines from each data point to the corresponding centroid.

Value

  • No value is returned.

Details

pca3d shows a three dimensional representation of a PCA object or any other matrix. It uses the rgl package for rendering.

Examples

Run this code
data( metabo )
  pca <- prcomp( metabo[,-1], scale.= TRUE )

  pca3d( pca, group= metabo[,1] )

Run the code above in your browser using DataLab