vizu.mat {mdpeer} | R Documentation |
Visualize matrix data in a form of a heatmap, with continuous values legend
Description
Matrix data visualization in a form of a heatmap, with
the use of ggplot2
library. Minimum user input (a matrix object) is needed to produce decent visualization output.
Automatic plot adjustments are implemented and used as defaults, including
selecting legend color palette and legend scale limits. Further
plot adjustments are available, including
adding a title, font size change, axis label clearing and others.
Usage
vizu.mat(matrix.object, title = "", base_size = 12, adjust.limits = TRUE,
adjust.colors = TRUE, fill.scale.limits = NULL, colors.palette = NULL,
geom_tile.colour = "grey90", clear.labels = TRUE, clear.x.label = FALSE,
clear.y.label = FALSE, uniform.labes = FALSE, rotate.x.labels = FALSE,
x.lab = "", y.lab = "", axis.text.x.size = base_size - 2,
axis.text.y.size = base_size - 2, axis.title.x.size = base_size - 2,
axis.title.y.size = base_size - 2, legend.text.size = base_size - 2,
legend.title.size = base_size - 2, legend.title = "value",
text.font.family = "Helvetica", remove.legend = FALSE,
axis.text.x.breaks.idx = NULL, axis.text.y.breaks.idx = NULL)
Arguments
matrix.object |
matrix |
title |
plot title |
base_size |
base font size |
adjust.limits |
logical whether or not adjust legend scale limits automatically:
|
adjust.colors |
logical whether or not adjust legend color automatically:
|
fill.scale.limits |
2-element vector defining legend scale limits |
colors.palette |
legend color color palette |
geom_tile.colour |
tiles color value |
clear.labels |
logical whether or not clear both x- and y-axis labels |
clear.x.label |
logical whether or not clear x-axis labels |
clear.y.label |
logical whether or not clear y-axis labels |
uniform.labes |
logical whether or not define generic short column and rows labeling:
|
rotate.x.labels |
logical whether or not rotate x-axis labels by 90 degrees |
x.lab |
x-axis label |
y.lab |
y-axis label |
axis.text.x.size |
font size of x-axis text |
axis.text.y.size |
font size of y-axis text |
axis.title.x.size |
font size of x-axis label |
axis.title.y.size |
font size of y-axis label |
legend.text.size |
font size of legend text |
legend.title.size |
font size of legend title |
legend.title |
legend title |
text.font.family |
font family |
remove.legend |
logical whether or not remove legend |
axis.text.x.breaks.idx |
indices of x-axis elements whose thicks are kept and whose numerical labels are kept |
axis.text.y.breaks.idx |
indices of y-axis elements whose thicks are kept and whose numerical labels are kept |
Value
ggplot2
object
Examples
mat <- matrix(rnorm(30*30), nrow = 30, ncol = 30)
vizu.mat(mat)
vizu.mat(mat, fill.scale.limits = c(-3,3))
vizu.mat(mat, fill.scale.limits = c(-10,10))
vizu.mat(mat, fill.scale.limits = c(-10,10),
uniform.labes = TRUE, clear.labels = FALSE)
colnames(mat) <- paste0("col", 1:30, sample(LETTERS, 30, replace = TRUE))
rownames(mat) <- paste0("row", 1:30, sample(LETTERS, 30, replace = TRUE))
vizu.mat(mat, fill.scale.limits = c(-10,10),
clear.labels = FALSE,
rotate.x.labels = TRUE)
mat.positive <- abs(mat)
vizu.mat(mat.positive,
title = "positive values only -> legend limits and colors automatically adjusted",
clear.labels = FALSE,
rotate.x.labels = TRUE)