ggbiplot | R Documentation |
Pretty biplots using ggplots
ggbiplot(xobj, ...) ## S3 method for class 'princomp' ggbiplot(xobj, ...) ## S3 method for class 'prcomp' ggbiplot(xobj, ...) ## S3 method for class 'lda' ggbiplot(xobj, ...) ## S3 method for class 'plsda' ggbiplot(xobj, Yplot = FALSE, ...) ## S3 method for class 'splsda' ggbiplot(xobj, ...) ## S3 method for class 'matrix' ggbiplot(xobj, ...) ## Default S3 method: ggbiplot( xobj, grouping, select = 1:2, circle = FALSE, circle.prob = 0.69, plot.loadings = TRUE, label.loadings = FALSE, sub.loadings = 1:nrow(xobj$loadings), label.offset = 0, label.size = 4.5, scale.loadings = 1, col.loadings = scales::muted("red"), alpha = 1, col = grouping, shape = NULL, group.ellipse = FALSE, scale.ellipse = 1, group.cloud = FALSE, xlab = "", ylab = "", equalcoord = TRUE, size = 3, size.loadings = 1, loadingsOnTop = FALSE )
xobj |
The object to be plotted |
grouping |
an optional grouping vector (ie - for coloring points) |
select |
index of components to be plotted (must be length 2) |
circle |
enclose points in a circle |
circle.prob |
controls circle diameter (scales data std dev) if |
plot.loadings |
should loading vectors be plotted |
label.loadings |
text of loadings labels, taken from rownames of loadings (depends on class of |
label.offset |
absolute offset for loading labels, so labels don't cover loadings vectors |
scale.loadings |
scale length of loading vectors for plotting purposes |
col.loadings |
a single value of vector for color of loadings |
alpha |
controls relative transparency of various plot features |
col |
color factor for points |
group.ellipse |
enclose within-group points in an covariance ellipse |
scale.ellipse |
scale |
group.cloud |
connect within-group points to a group mean point with a straight edge |
xlab |
label for x axis |
ylab |
label for y axis |
equalcoord |
equal coordinates, ie should the plot area be square? |
size |
point size |
size.loadings |
line width of loading vectors |
additional plotting attributes (eg colors, themes, etc) can be chained on in the usual way for ggplots
# an LDA example with iris data ldamod <- lda(iris[,1:4], grouping=iris[,5]) ggbiplot(ldamod, grouping=iris[,5], alpha=.7, group.cloud=TRUE) + theme_bw()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.