R: Plot vectors inside a unit circle (PCA loadings or...
vectorplot
R Documentation
Plot vectors inside a unit circle (PCA loadings or correlations plots)
Description
Plots vectors with 0<norms<1 inside a circle. These plots are mainly designed
to represent variables in principal components space for PCAs.
Usage
vectorplot(x, ...)
## Default S3 method:
vectorplot(x, y, col = par("col"), circle.col = "gray",
ar.length = 0.1, pos = NULL, cex = par("cex"), labels = NULL, ...)
## S3 method for class 'loadings'
vectorplot(x, choices = 1L:2L, col = par("col"),
circle.col = "gray", ar.length = 0.1, pos = NULL, cex = par("cex"),
labels = rownames(x), main = deparse(substitute(x)), ...)
## S3 method for class 'correlation'
vectorplot(x, choices = 1L:2L, col = par("col"),
circle.col = "gray", ar.length = 0.1, pos = NULL, cex = par("cex"),
labels = rownames(x), main = deparse(substitute(x)), ...)
Arguments
x
an object that has a vectorplot() method, like 'loadings'
or 'correlation', or a numeric vector with 0<values<1.
y
a numeric vector with 0<values<1 of same length as x.
choices
a vector of two integers indicating the axes to plot.
col
color of the arrows and labels.
circle.col
the color for the circle around the vector plot.
ar.length
the length of the arrows.
pos
the position of text relative to arrows. If NULL, a
suitable position is calculated according to the direction where the
arrows are pointing.
cex
the factor of expansion for labels in the graph.
labels
the labels to write.
main
the title of the graph.
...
further arguments passed to plot functions.
Value
The object 'x' is returned invisibly. These functions are called for their
side-effect of drawing a vector plot.
Author(s)
Philippe Grosjean <phgrosjean@sciviews.org>.
See Also
pcomp, loadings,
correlation
Examples
## Create a PCA and plot loadings and correlations
iris.pca <- pcomp(iris[, -5])
vectorplot(loadings(iris.pca))
vectorplot(correlation(iris.pca))
## Note: on screen devices, change aspect ratio of the graph by resizing
## the window to reveal cropped labels...
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(SciViews)
Loading required package: MASS
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/SciViews/vectorplot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: vectorplot
> ### Title: Plot vectors inside a unit circle (PCA loadings or correlations
> ### plots)
> ### Aliases: vectorplot vectorplot.default vectorplot.loadings
> ### vectorplot.correlation
> ### Keywords: aplot
>
> ### ** Examples
>
> ## Create a PCA and plot loadings and correlations
> iris.pca <- pcomp(iris[, -5])
> vectorplot(loadings(iris.pca))
> vectorplot(correlation(iris.pca))
> ## Note: on screen devices, change aspect ratio of the graph by resizing
> ## the window to reveal cropped labels...
>
>
>
>
>
> dev.off()
null device
1
>