This function generates a simple biplot out of various sources and allows to give color and symbol to the x-objects individually.
# S3 method for default
coloredBiplot(x, y, var.axes = TRUE, col,
cex = rep(par("cex"), 2), xlabs = NULL, ylabs = NULL, expand=1,
xlim = NULL, ylim = NULL, arrow.len = 0.1, main = NULL, sub = NULL,
xlab = NULL, ylab = NULL, xlabs.col = NULL, xlabs.bg = NULL,
xlabs.pc=NULL, ...)
# S3 method for princomp
coloredBiplot(x, choices = 1:2, scale = 1,
pc.biplot=FALSE, ...)
# S3 method for prcomp
coloredBiplot(x, choices = 1:2, scale = 1,
pc.biplot=FALSE, ...)
a representation of the the co-information to be plotted, given by a result of princomp or prcomp; or the first set of coordinates to be plotted
optional, the second set of coordinates to be potted
if 'TRUE' the second set of points have arrows representing them as (unscaled) axes
one color (to be used for the y set) or a vector of two colors
(to be used for x and y sets respectively, if xlabs.col
is NULL)
the usual cex parameter for plotting; can be a length-2 vector to format differently x and y labels/symbols
names to write for the points of the first set
names to write for the points of the second set
expansion factor to apply when plotting the second set of points relative to the first. This can be used to tweak the scaling of the two sets to a physically comparable scale
horizontal axis limits
vertical axis limits
length of the arrow heads on the axes plotted if 'var.axes' is true. The arrow head can be suppressed by 'arrow.len=0'
main title
subtitle
horizontal axis title
vertical axis title
the color(s) to draw the points of the first set, if
xlabs
is null
the filling color(s) to draw the points of the first set, if
xlabs
is null and xlabs.pc
is between 21 and 25.
the plotting character(s) for the first set, if
xlabs
is null
the way to distribute the singular values on the
right or left singular vectors for princomp and prcomp objects
(see biplot
)
the components to be plotted (see biplot
)
should be scaled by sqrt(nrow(X))
?
(see biplot
)
further parameters for plot
The function is called only for the side effect of plotting. It is a modification of the standard R routine 'biplot'.
The functions is provided for convenience.
# NOT RUN {
data(SimulatedAmounts)
coloredBiplot(x=princomp(acomp(sa.outliers5)),pc.biplot=FALSE,
xlabs.pc=c(1,2,3), xlabs.col=2:4, col="black")
# }
Run the code above in your browser using DataLab