Description Usage Arguments Value Examples
This creates a ggplot2 layer that plots the correlation values of the scores for components against the real values, as obtained from dimensionality reduction methods. These methods include principal components analysis and partial least squares.
1 2 3 4 5 6 7 | geom_corr_circle(mapping = NULL, data = NULL, stat = "identity",
position = "identity", ..., na.rm = FALSE, show.legend = NA,
outer.linetype = "solid", outer.linecolour = "black",
outer.linesize = 0.5, inner.linetype = "dotted",
inner.linecolour = "black", inner.linesize = 0.5,
center.linetype = "solid", center.linecolour = "grey50",
center.linesize = 0.3, inherit.aes = TRUE)
|
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
The statistical transformation to use on the data for this layer, as a string. |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
other arguments passed on to |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
outer.linetype, outer.linecolour, outer.linesize |
The line type, colour, and size for the outer circle line. |
inner.linetype, inner.linecolour, inner.linesize |
The line type, colour, and size for the inner circle line. |
center.linetype, center.linecolour, center.linesize |
The line type, colour, and size for the two center lines. |
inherit.aes |
If |
Adds a ggplot2 geom layer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | library(ggplot2)
library(broom)
library(pls)
data(yarn)
# Set up data to plot.
fit <- plsr(density ~ NIR, 6, data = yarn, validation = "CV")
fit <- cor(model.matrix(fit), scores(fit)[, 1:2, drop = FALSE])
fit <- as.data.frame(fit)
fit$Variables <- rownames(fit)
rownames(fit) <- NULL
colnames(fit)[1:2] <- c("Comp1", "Comp2")
fit$Groups <- as.factor(sample.int(2, nrow(fit), replace = TRUE))
p <- ggplot(fit, aes(x = Comp1, y = Comp2))
p + geom_corr_circle()
p + geom_corr_circle(outer.linetype = "dotted")
p + geom_corr_circle(inner.linecolour = "blue")
p + geom_corr_circle(center.linesize = 1)
p + geom_corr_circle(center.linecolour = "grey50", size = 3)
# If you want to remove the circle or center lines, use 0.
p + geom_corr_circle(center.linetype = 0)
p + geom_corr_circle(outer.linetype = 0)
# With grouping
p + geom_corr_circle(aes(colour = Groups))
p + geom_corr_circle(aes(colour = Groups), size = 3) +
scale_colour_brewer()
p + geom_corr_circle(aes(alpha = Groups))
p + geom_corr_circle(aes(size = Groups))
p + geom_corr_circle(aes(shape = Groups), size = 2)
# With facets
p + geom_corr_circle() +
facet_grid(~ Groups)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.