Learn R Programming

Correlplot (version 1.1.0)

ggtally: Create a correlation tally stick on a biplot vector

Description

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.

Usage

ggtally(G, p1, adj = 0, values = seq(-1, 1, by = 0.2), dotsize = 0.1, dotcolour = "black")

Value

A ggplot2 object with the updated biplot

Arguments

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

Author

Jan Graffelman (jan.graffelman@upc.edu)

Details

Any set of values for the correlation to be marked off can be used, though a standard scale with 0.2 increments is recommmended.

References

Graffelman, J. and De Leeuw, J. (2023) On the visualisation of the correlation matrix. Available online. tools:::Rd_expr_doi("10.48550/arXiv.2211.13150")

See Also

ggbplot

Examples

Run this code
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)

Run the code above in your browser using DataLab