ggtally | R Documentation |
Function ggtally
puts a series of dots along a biplot vector of a correlation matrix,
so marking the change in correlation along the vector with specified values.
ggtally(G, p1, adj = 0, values = seq(-1, 1, by = 0.2), dotsize = 0.1, dotcolour = "black")
G |
A matrix (or vector) of biplot markers |
p1 |
A ggplot2 object with a biplot |
adj |
A scalar adjustment for the correlations |
values |
Values of the correlations to be marked off by dots |
dotsize |
Size of the dot |
dotcolour |
Colour of the dot |
Any set of values for the correlation to be marked off can be used, though a standard scale with 0.2 increments is recommmended.
A ggplot2 object with the updated biplot
Jan Graffelman (jan.graffelman@upc.edu)
Graffelman, J. and De Leeuw, J. (2023) On the visualisation of the correlation matrix. Available online. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.48550/arXiv.2211.13150")}
ggbplot
library(calibrate)
data(goblets)
R <- cor(goblets)
out.sd <- eigen(R)
V <- out.sd$vectors[,1:2]
Dl <- diag(out.sd$values[1:2])
Gp <- crossprod(t(V),sqrt(Dl))
pca.df <- data.frame(Gp)
pca.df$strings <- colnames(R)
colnames(pca.df) <- c("PA1","PA2","strings")
p1 <- ggbplot(pca.df,pca.df,main="PCA correlation biplot",xlab="",ylab="",rowarrow=TRUE,
rowcolor="blue",rowch="",colch="")
p1 <- ggtally(Gp,p1,values=seq(-0.2,0.6,by=0.2),dotsize=0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.