Triangle Plot
Function for making a triangle plot from a square matrix
triangleplot (x, y=NULL, cutpts=NULL, details=TRUE, n.col.legend=5, cex.col=0.7, cex.var=0.9, digits=1, color=FALSE)
x |
a square matrix. |
y |
a vector of names that corresponds to each element of the square matrix x. |
cutpts |
a vector of cutting points for color legend, default is |
details |
show more than one digits correlaton values. Default
is |
n.col.legend |
number of legend for the color thermometer |
cex.col |
font size of the color thermometer. |
cex.var |
font size of the variable names. |
digits |
number of digits shown in the text of the color theromoeter. |
color |
color of the plot, default is FALSE, which uses gray scale. |
The function makes a triangle plot from a square matrix, e.g., the correlation plot, see
corrplot
. If a square matrix contains missing values, the cells of missing values
will be marked x
.
Yu-Sung Su suyusung@tsinghua.edu.cn
old.par <- par(no.readonly = TRUE) # create a square matrix x <- matrix(runif(1600, 0, 1), 40, 40) # fig 1 triangleplot(x) # fig 2 assign cutting points triangleplot(x, cutpts=c(0,0.25,0.5,0.75,1), digits=2) # fig 3 if x contains missing value x[12,13] <- x[13,12] <- NA x[25,27] <- x[27,25] <- NA triangleplot(x) par(old.par) # #library(RColorBrewer) #cormat <- cor(iris[,-5]) #triangleplot2(cormat,color = brewer.pal( 5, "RdBu" ), # n.col.legend=5, cex.col=0.7, cex.var=0.5)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.