netVis_heatmap | R Documentation |
This function produces heatmap that shows the number of interactions, interaction
strength, or communication probabilities of a chosen pathway in a single dataset
(defined by pathway =
), as well as showing the differential comparison of the
chosen measures between two datasets.
netVis_heatmap(
obj,
comparison = c(1, 2),
measure = c("count", "weight", "prob"),
pathway = NULL,
heatmap_colors = c("#4575b4", "#d73027"),
heatmap_colors_min = NULL,
heatmap_colors_max = NULL,
cluster_rows = FALSE,
cluster_columns = FALSE,
row_names_rot = 0,
column_names_rot = 90,
fontsize = 9,
cell_fontsize = 9,
show_values = TRUE,
legend_side = "bottom",
legend_direction = "horizontal",
legend_title = NULL,
legend_title_position = "leftcenter",
legend_width = unit(5, "cm"),
legend_height = NULL,
right_anno_width = unit(2, "cm"),
top_anno_height = unit(2, "cm"),
anno_colors = c("#66c2a5", "#fc8d62"),
anno_legend_ncol = 1,
anno_legend_side = "bottom",
anno_legend_direction = "horizontal",
anno_legend_title = "Sample",
anno_legend_title_position = "leftcenter",
plot_title = NULL,
title_prefix = NULL,
row_title = "Sources (outgoing signaling)",
draw = TRUE,
data_only = FALSE
)
obj |
A CellChat object containing one or merged datasets. |
comparison |
A numerical or character vector of length 2, to indicate the
datasets for comparison. Default is |
measure |
Define the measure to plot, |
pathway |
A string to indicate the name of signaling networks in the CellChat
object. This is required when |
heatmap_colors |
A character vector to indicate the colours used to generate a
colour palette. The first colour provided is used to create a sequential palette
for single-data CellChat object. When comparing two datasets, a diverging palette
is created to match the max/min values. Default is |
heatmap_colors_min |
A numeric value to set the minimum value used to generate
the colour palette. Default is |
heatmap_colors_max |
A numeric value to set the maximum value used to generate
the colour palette. Default is |
cluster_rows |
A logical value to indicate whether to cluster on rows.
Default is |
cluster_columns |
A logical value to indicate whether to cluster on columns.
Default is |
row_names_rot |
A numeric value to set the rotation of row names.
Default is |
column_names_rot |
A numeric value to set the rotation of column names.
Default is |
fontsize |
A numeric value to set the overall font size. Default is |
cell_fontsize |
A numeric value to set the font size of the values in each
cell. Default is |
show_values |
A logical value to indicate whether to show the values in each
cell. Default is |
legend_side |
A string to indicate the side to put heatmap legend.
Possible options are |
legend_direction |
A string to indicate the direction of the heatmap legend.
Possible options are |
legend_title |
A string to indicate the heatmap legend title. Default is |
legend_title_position |
A string to indicate the position of title relative
to the heatmap legend. Possible options are |
legend_width |
A |
legend_height |
A |
right_anno_width |
A |
top_anno_height |
A |
anno_colors |
A character vector to indicate the colours used to fill the
box plots showing the two datasets, or a single colour used to fill the bar plots
showing a single dataset. Default is |
anno_legend_ncol |
A integer to set the number of columns in the legend grids.
Default is |
anno_legend_side |
A string to indicate the side to put annotation legend.
Default is |
anno_legend_direction |
A string to indicate the direction of the annotation
legend. Default is |
anno_legend_title |
A string to indicate the annotation legend title. Default is "Sample". |
anno_legend_title_position |
A string to indicate the position of title relative
to the annotation legend. Default is |
plot_title |
A string to indicate the plot (column) title. Default is |
title_prefix |
A string to append to the plot (column) title. Default is |
row_title |
A string to indicate the row title.
Default is |
draw |
A logical value to indicate whether to draw the heatmap.
When |
data_only |
A logical value to indicate whether to return a list containing the
calculated values. This is useful for users to create their own plots.
When |
When showing differential comparison:
Using the default heatmap_colors
, the red (or blue) represents increased
(or decreased) signaling in the second dataset compared to the first one.
The box plots on the top show the original values of the selected measure
from cell groups from the two datasets in each column (incoming signaling).
The box plots on the right show the original values of the selected measure
from cell groups from the two datasets in each row (outgoing signaling).
The function offers an alternative method to create heatmap from CellChat object.
Compared to CellChat::netVisual_heatmap
function, it offers more controls to the
plot aesthetic and offers two output types (defined by draw =
): to plot on device
or provide a gTree
object. This can be used with other R package such as 'patchwork'
(might require warpping gTree
object with wrap_elements
function), 'cowplot'
(with plot_grid
function) or 'gridExtra' (with grid.arrange
function) to combine
multiple heatmaps, or with other type of plot object types such as ggplot
into a
single graphic.
For users who will like to create their own plots, one can use data_only = TRUE
to
obtain a list that contains the matrix with the calculated values, and optionally the
original values of the selected measure
from cell groups from the two datasets when
showing differential comparison.
A plot appears on currect plotting device if draw = FALSE
.
When draw = FALSE
, the function retuns a grob (gTree
) object made with package
grid
. When data_only = TRUE
, the function retuns list
object containing the
data values.
I-Hsuan Lin
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.