radioHeat: Visualize a (correlation) matrix as a heatmap

Description Usage Arguments Details Note Author(s) References See Also Examples

View source: R/FMradio.R

Description

radioHeat is a function that provides dedicated heatmapping of a radiomics-based correlation matrix It can be used to visually assess the elements of a (possibly thresholded) matrix. It also supports the assessment of collinearity.

Usage

1
2
3
radioHeat(R, lowColor = "blue", highColor = "red", labelsize = 10,
          diag = TRUE, threshold = FALSE, threshvalue = .95,
          values = FALSE, textsize = 10, legend = TRUE, main = "")

Arguments

R

(regularized) correlation matrix

lowColor

A character that determines the color scale in the negative range.

highColor

A character that determines the color scale in the positive range.

labelsize

A numeric that sets the textsize of row and column labels.

diag

A logical determining if the diagonal elements of the matrix should be included in the color scaling. This argument is only used when R is a square matrix.

threshold

A logical determining if only values above a certain (absolute) threshold should be visualized.

threshvalue

A numeric indicating the absolute thresholding value when threshold = TRUE.

values

A logical determining the optional inclusion of cell-values.

textsize

A numeric indicating the textsize of the cell-values when values = TRUE.

legend

A logical indicating whether a color legend should be included.

main

A character giving the main figure title.

Details

This function utilizes ggplot2 (Wickham, 2009) to visualize a matrix as a heatmap: a false color plot in which the individual matrix entries are represented by colors. lowColor determines the color scale for matrix entries in the negative range. highColor determines the color scale for matrix entries in the positive range. For the colors supported by the arguments lowColor and highColor, see https://stat.columbia.edu/~tzheng/files/Rcolor.pdf. White entries in the plot represent the midscale value of 0. One can opt to set the diagonal entries to the midscale color of white when one is interested in (heatmapping) the off-diagonal elements only. To achieve this, set diag = FALSE. Naturally, the diag argument is only used when the input matrix M is a square matrix.

The intended usage is to visualize a correlation matrix on radiomic features as a heatmap. Such a heatmap may be used to support the assessment of strong collinearity or even redundancy amongst the features. To this end, it is also possible to visualize a thresholded correlation matrix when threshold = TRUE based on the absolute thresholding value given in the threshvalue argument (hence the thresholding is done internally). This enables easier visual access to (blocks of) collinearity in radiomic-feature-based correlation matrices.

Note

Author(s)

Carel F.W. Peeters <cf.peeters@vumc.nl>

References

Wickham, H. (2009). ggplot2: elegant graphics for data analysis. New York: Springer.

See Also

RF, regcor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Generate some (high-dimensional) data
p = 25
n = 10
set.seed(333)
X = matrix(rnorm(n*p), nrow = n, ncol = p)
colnames(X)[1:25] = letters[1:25]
R <- cor(X)

## Visualize the correlation matrix as a heatmap
radioHeat(R)

## Remove diagonal entries from visualization
radioHeat(R, diag = FALSE)

## Additionally, visualize only those entries whose absolute value exceed .5
radioHeat(R, diag = FALSE, threshold = TRUE, threshvalue = .5)

## Additionally, include cell values
radioHeat(R, diag = FALSE, threshold = TRUE, threshvalue = .5, 
          values = TRUE, textsize = 3)

Example output



FMradio documentation built on Dec. 16, 2019, 5:43 p.m.