projAxes {flexclust} | R Documentation |
Add Arrows for Projected Axes to a Plot
Description
Adds arrows for original coordinate axes to a projection plot.
Usage
projAxes(object, which=1:2, center=NULL,
col="red", radius=NULL,
minradius=0.1, textargs=list(col=col),
col.names=getColnames(object),
which.names="", group = NULL, groupFun = colMeans,
plot=TRUE, ...)
placeLabels(object)
## S4 method for signature 'projAxes'
placeLabels(object)
Arguments
object |
Return value of a projection method like
|
which |
Index number of dimensions of (projected) input space that have been plotted. |
center |
Center of the coordinate system to use in projected space. Default is the center of the plotting region. |
col |
Color of arrows. |
radius |
Relative size of the arrows. |
minradius |
Minimum radius of arrows to include (relative to arrow size). |
textargs |
List of arguments for |
col.names |
Variable names of the original data. |
which.names |
A regular expression which variable names to include in the plot. |
group |
An optional grouping variable for the original
coordinates. Coordinates with group |
groupFun |
Function used to aggregate the projected coordinates
if |
plot |
Logical,if |
... |
Passed to |
Value
projAxes
invisibly returns an object of class
"projAxes"
, which can be
added to an existing plot by its plot
method.
Author(s)
Friedrich Leisch
Examples
data(milk)
milk.pca <- prcomp(milk, scale=TRUE)
## create a biplot step by step
plot(predict(milk.pca), type="n")
text(predict(milk.pca), rownames(milk), col="green", cex=0.8)
projAxes(milk.pca)
## the same, but arrows are blue, centered at origin and all arrows are
## plotted
plot(predict(milk.pca), type="n")
text(predict(milk.pca), rownames(milk), col="green", cex=0.8)
projAxes(milk.pca, col="blue", center=0, minradius=0)
## use points instead of text, plot PC2 and PC3, manual radius
## specification, store result
plot(predict(milk.pca)[,c(2,3)])
arr <- projAxes(milk.pca, which=c(2,3), radius=1.2, plot=FALSE)
plot(arr)
## Not run:
## manually try to find new places for the labels: each arrow is marked
## active in turn, use the left mouse button to find a better location
## for the label. Use the right mouse button to go on to the next
## variable.
arr1 <- placeLabels(arr)
## now do the plot again:
plot(predict(milk.pca)[,c(2,3)])
plot(arr1)
## End(Not run)