R: Triangle Plot

triangleplot {arm} | R Documentation

## Triangle Plot

### Description

Function for making a triangle plot from a square matrix

### Usage

    triangleplot (x, y=NULL, cutpts=NULL, details=TRUE,
                n.col.legend=5, cex.col=0.7,
                cex.var=0.9, digits=1, color=FALSE)

### Arguments

`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 `NULL`. The function will decide the cutting points if cutpts is not assigned.
`details` | show more than one digits correlaton values. Default is `TRUE`. `FALSE` is suggested to get readable output.
`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.

### Details

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`.

### Author(s)

Yu-Sung Su suyusung@tsinghua.edu.cn

### See Also

`corrplot`, `par`

### Examples

    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)

[Package arm version 1.9-3 Index]