radioHeat {FMradio} | R Documentation |
Visualize a (correlation) matrix as a heatmap
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
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 |
lowColor |
A |
highColor |
A |
labelsize |
A |
diag |
A |
threshold |
A |
threshvalue |
A |
values |
A |
textsize |
A |
legend |
A |
main |
A |
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
While geared towards the visualization of correlation matrices, the function is quite general, in the sense that it can represent any
matrix
as a heatmap.When
values = TRUE
andthreshold = TRUE
the cell-values are those of the thresholded matrix.
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
Examples
## 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)