Visualizes multiple network layers as heatmaps on tilted 3D-perspective planes, similar to the plot_mlna network visualization style.
plot_ml_heatmap(
x,
layer_list = NULL,
colors = "viridis",
layer_spacing = NULL,
skew = 0.4,
compress = 0.6,
show_connections = FALSE,
connection_color = "#E63946",
connection_style = "dashed",
show_borders = TRUE,
border_color = "black",
border_width = 1,
cell_border_color = "white",
cell_border_width = 0.2,
show_labels = TRUE,
show_node_labels = TRUE,
node_label_size = 3,
label_size = 5,
show_legend = TRUE,
legend_title = "Weight",
title = NULL,
limits = NULL,
na_color = "grey90",
threshold = 0
)A ggplot2 object.
A list of matrices (one per layer), a group_tna object, cograph_network, or a single matrix with layer_list specified.
Optional list defining layers, column name string, or NULL for auto-detection from cograph_network nodes.
Color palette: "viridis", "heat", "blues", "reds", "inferno", "plasma", or a vector of colors. Default "viridis".
Vertical spacing between layers, in data units. A
plane is nrow(x) * compress units tall, so a fixed spacing that
suits a small network makes a larger one overlap itself. NULL
(the default) scales the spacing to the plane so planes never collide;
pass a number for the older absolute behavior.
Horizontal skew for perspective effect (0-1). Default 0.4.
Vertical compression for perspective (0-1). Default 0.6.
Show inter-layer connection lines? Default FALSE.
Color for inter-layer connections. Default "#E63946".
Line style: "dashed", "solid", "dotted". Default "dashed".
Show layer outline borders? Default TRUE.
Color for layer borders. Default "black".
Width of layer borders. Default 1.
Color for cell borders. Default "white".
Width of cell borders. Default 0.2.
Show layer name labels? Default TRUE.
Show the row and column names of the matrix? Default TRUE. Without them a plane is an anonymous grid and a reader cannot tell which cell is which pair. Every plane shares one node ordering, so the names are drawn once, against the front plane: rows down its left edge, columns along its lower edge.
Size of the row and column names. Default 3.
Size of layer labels. Default 5.
Show color legend? Default TRUE.
Title for legend. Default "Weight".
Plot title. Default NULL.
Color scale limits c(min, max). NULL for auto.
Color for NA values. Default "grey90".
Minimum absolute value to display. Cells with
abs(value) < threshold are set to NA (rendered as background).
Default 0.
set.seed(1)
layers <- list(
L1 = matrix(runif(16), 4, 4),
L2 = matrix(runif(16), 4, 4),
L3 = matrix(runif(16), 4, 4))
plot_ml_heatmap(layers)
plot_ml_heatmap(layers, show_connections = TRUE, colors = "plasma")
Run the code above in your browser using DataLab