CCC heatmap and dot matrix plot
Usage
CCCHeatmap(
object,
method = NULL,
condition = NULL,
dataset = 1,
comparison = c(1, 2),
plot_type = c("heatmap", "focused_heatmap", "dot", "matrix_dot", "tile",
"source_target_dot", "source_target_tile", "sample_dot", "bubble", "bubble_lr",
"pathway_bubble", "ligand_target", "role_heatmap", "role_network",
"role_network_marsilea", "diff_heatmap"),
display_by = c("aggregation", "interaction"),
sender.use = NULL,
receiver.use = NULL,
ligand.use = NULL,
receptor.use = NULL,
interaction.use = NULL,
signaling = NULL,
pairLR.use = NULL,
slot.name = "net",
thresh = 0.05,
measure = c("count", "weight"),
pattern = c("outgoing", "incoming", "all"),
value = "sum",
top_n = 500,
top_anno = "bar",
right_anno = "cell",
left_anno = "bar",
bottom_anno = "cell",
bar_value = "sum",
add_text = NULL,
cluster_rows = FALSE,
cluster_columns = FALSE,
color.by = c("score", "pvalue"),
x_text_angle = 90,
facet_by = NULL,
show_row_names = TRUE,
show_column_names = TRUE,
edge_value = c("sum", "mean", "max", "count"),
border = TRUE,
value_palette = "RdBu",
value_palcolor = NULL,
cell_palette = "Chinese",
cell_palcolor = NULL,
palette = "Chinese",
palcolor = NULL,
width = NULL,
height = NULL,
units = "inch",
title = NULL,
subtitle = NULL,
legend.position = "right",
legend.direction = "vertical",
font.size = 10,
theme_use = "theme_scop",
theme_args = list(),
verbose = TRUE,
combine_methods = c("separate", "support", "rank", "legacy"),
resource = NULL,
sample = NULL,
srt = NULL,
row_bar_color = NULL,
column_bar_color = NULL,
...
)Arguments
- object
A
Seuratobject.- method
Communication result type to use.
- condition
Result name or comparison name.
- dataset
Dataset index or name.
- comparison
Comparison indices or names.
- plot_type
Plot type. One of
"heatmap"or"dot"."bubble"is a CellChat interaction matrix with sender–receiver pairs on rows and ligand–receptor interactions on columns. By default, color shows communication probability and size shows p-value bands:p <= 0.01,0.01 < p <= 0.05, andp > 0.05. Comparisons share scales across condition panels. Shared matrix bubbles use upper and left summary bars by default; add cell strips explicitly if needed. Nonnegative scores use a sequential red scale unless a value palette is supplied."ligand_target"is a special heatmap path available only withNicheNet/MultiNicheNetresults."role_heatmap"and"diff_heatmap"are CellChat-specific pathway role views. In"tile", each ligand–receptor cell shows the maximum communication score or the smallest available p-value across the selected partners. The minimum is a descriptive summary, not a combined test. Use"dot"for pair-level values.- display_by
Whether to summarize by
"aggregation"or"interaction".- sender.use
Sender cell types to keep.
- receiver.use
Receiver cell types to keep.
- ligand.use
Ligands to keep.
- receptor.use
Receptors to keep.
- interaction.use
Interaction names to keep.
- signaling
Signaling pathway to focus on.
- pairLR.use
Specific ligand-receptor pair(s) to keep.
- slot.name
CellChat slot name.
- thresh
Significance threshold used when extracting communication results.
- measure
Summary measure for CellChat objects.
- pattern
Pattern used for pathway role plots.
- value
Value column or summary statistic to use.
- top_n
Number of top records to retain.
- top_anno, bottom_anno
Column-side annotations for sender groups. Each side accepts
NULL,"bar","box","point","line","histogram","density","violin","cell", or a character vector containing multiple values. Defaults aretop_anno = "bar"andbottom_anno = "cell". In"tile"plots,bottom_anno = "cell"adds a slim cell-type color strip above each panel's column labels. Usebottom_anno = NULLto hide it.- left_anno, right_anno
Row-side annotations for receiver groups. Each side accepts
NULL,"bar","box","point","line","histogram","density","violin","cell", or a character vector containing multiple values. Defaults areleft_anno = "bar"andright_anno = "cell".- bar_value
Aggregation metric shown in the bar annotations. One or more of
"count","sum","mean", or"max". Multiple values add multiple annotation tracks. Default"sum".- add_text
Logical. Show numeric value labels inside each cell (heatmap mode only). Default
TRUEfor aggregation mode,FALSEfor interaction mode.- cluster_rows, cluster_columns
Whether to cluster heatmap rows/columns. Defaults are both
FALSE.- color.by
For interaction heatmaps, value used for tile coloring. Usually
"score"or"pvalue".- x_text_angle
Rotation angle for x-axis labels.
- facet_by
Faceting variable for interaction-level plots.
- show_row_names, show_column_names
Whether to draw row/column names for the heatmap body.
- edge_value
Aggregation statistic for network edges.
- border
Logical. Whether to draw borders for the heatmap body and all annotation tracks. Default
TRUE.- value_palette
Palette used for heatmap value fills.
- value_palcolor
Optional custom colors for
value_palette.- cell_palette
Cell annotation palette name.
- cell_palcolor
Custom cell annotation colors.
- palette
Main palette name.
- palcolor
Main custom palette colors.
- width, height
Optional heatmap body width and height. When only one is supplied, the other is inferred from the matrix dimensions to keep cells square. When both are
NULL, the body is sized automatically from the matrix and labels.- units
Units for
widthandheight. Default"inch".- title
Plot title.
- subtitle
Plot subtitle.
- legend.position
Legend placement (
"none","left","right","bottom","top"), direction, and title.legend.title = NULLuses the group name.- legend.direction
Legend direction:
"horizontal"or"vertical".- font.size
Base font size.
- theme_use, theme_args
Theme name or function, plus extra theme arguments.
- verbose
Whether to print messages.
- combine_methods
Behavior when
method = "CCC"."separate"returns one panel per backend,"support"counts supporting backends,"rank"combines within-method percentile ranks for visualization, and"legacy"retains the deprecated raw-score aggregation.- resource, sample
Optional resource and sample/context filters for unified CCC results. Native CellChat plots use a stored result selected by
conditionand do not support these additional filters.- srt
Deprecated alias for
object; supply exactly one of the two. It will be removed in scop 1.0.0.- row_bar_color, column_bar_color
Optional colors for the summary bars in shared matrix bubble plots. Each defaults to the first cell palette color and can be overridden independently.
- ...
Arguments passed to other functions.
Details
Canonical selection parameters and legacy aliases may be supplied
together only when their values agree. Conflicting values raise an error.
width and height here control the heatmap body, not the canvas.
Aggregation heatmaps retain receivers on rows and senders on columns. By default, the top and left show bars; the bottom and right show cell-type color strips. The legend is on the right and sender labels are rotated by 90 degrees. The export is sized from the rendered heatmap.
Examples
data(pancreas_sub)
pancreas_sub <- RunStandardWorkflow(pancreas_sub)
#> ℹ [2026-12-03 11:29:14] Start standard processing workflow...
#> ℹ [2026-12-03 11:29:14] Checking a list of <Seurat>...
#> ! [2026-12-03 11:29:14] Data 1/1 of the `srt_list` is "unknown"
#> Warning: Data 1/1 of the `srt_list` is "unknown"
#> ℹ [2026-12-03 11:29:14] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#> ℹ [2026-12-03 11:29:14] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#> ℹ [2026-12-03 11:29:14] Use the separate HVF from `srt_list`
#> ℹ [2026-12-03 11:29:14] Number of available HVF: 2000
#> ℹ [2026-12-03 11:29:16] Finished check
#> ℹ [2026-12-03 11:29:16] Perform `ScaleData()`
#> ℹ [2026-12-03 11:29:16] Perform pca linear dimension reduction
#> ℹ [2026-12-03 11:29:16] Use stored estimated dimensions 1:23 for Standardpca
#> ℹ [2026-12-03 11:29:16] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#> ℹ [2026-12-03 11:29:16] Reorder clusters...
#> ℹ [2026-12-03 11:29:16] Skip `log1p()` because `layer = data` is not "counts"
#> ℹ [2026-12-03 11:29:16] Perform umap nonlinear dimension reduction
#> ✔ [2026-12-03 11:29:21] Standard processing workflow completed
pc1 <- Seurat::Embeddings(pancreas_sub, "Standardpca")[, 1]
ct <- as.character(pancreas_sub$CellType)
ct_medians <- tapply(pc1, ct, median)
pancreas_sub$Condition <- ifelse(
pc1 > ct_medians[ct],
"ConditionA",
"ConditionB"
)
pancreas_sub <- RunCellChat(
pancreas_sub,
group.by = "CellType",
group_column = "Condition",
group_cmp = list(c("ConditionA", "ConditionB")),
species = "Mus_musculus"
)
#> ℹ [2026-12-03 11:29:21] Start CellChat analysis
#> ℹ [2026-12-03 11:29:22] Processing condition: "ConditionB"
#> [1] "Create a CellChat object from a data matrix"
#> Set cell identities for the new CellChat object
#> The cell groups used for CellChat analysis are Ductal, Endocrine, Ngn3-high-EP, Ngn3-low-EP, Pre-endocrine
#> The number of highly variable ligand-receptor pairs used for signaling inference is 554
#> triMean is used for calculating the average gene expression per cell group.
#> [1] ">>> Run CellChat on sc/snRNA-seq data <<< [2026-12-03 11:29:23.530321]"
#> [1] ">>> CellChat inference is done. Parameter values are stored in `object@options$parameter` <<< [2026-12-03 11:29:29.623919]"
#> ℹ [2026-12-03 11:29:29] Processing condition: "ConditionA"
#> [1] "Create a CellChat object from a data matrix"
#> Set cell identities for the new CellChat object
#> The cell groups used for CellChat analysis are Ductal, Endocrine, Ngn3-high-EP, Ngn3-low-EP, Pre-endocrine
#> The number of highly variable ligand-receptor pairs used for signaling inference is 598
#> triMean is used for calculating the average gene expression per cell group.
#> [1] ">>> Run CellChat on sc/snRNA-seq data <<< [2026-12-03 11:29:30.808311]"
#> [1] ">>> CellChat inference is done. Parameter values are stored in `object@options$parameter` <<< [2026-12-03 11:29:37.936825]"
#> ℹ [2026-12-03 11:29:38] Merging CellChat objects for comparison "ConditionA_vs_ConditionB"
#> Merge the following slots: 'data.signaling','images','net', 'netP','meta', 'idents', 'var.features' , 'DB', and 'LR'.
#> ✔ [2026-12-03 11:29:38] CellChat analysis completed
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "heatmap",
display_by = "aggregation",
top_n = 20
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "dot",
display_by = "interaction",
sender.use = "Ductal",
top_n = 20
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "dot",
display_by = "interaction",
receiver.use = "Ngn3-low-EP",
top_n = 20
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "heatmap",
display_by = "aggregation",
top_n = 20
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "heatmap",
display_by = "interaction",
facet_by = "sender",
top_n = 10
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "heatmap",
display_by = "interaction",
facet_by = "sender",
color.by = "pvalue",
top_n = 10
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "bubble",
top_n = 5
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA_vs_ConditionB",
plot_type = "bubble",
top_n = 5
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "role_heatmap",
#' pattern = "outgoing",
width = 0.6,
height = 2.5
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA",
plot_type = "role_heatmap",
pattern = "outgoing",
width = 0.6,
height = 2.5
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA_vs_ConditionB",
plot_type = "role_heatmap",
pattern = "incoming",
palette = "Paired",
width = 0.6,
height = 3.5
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA_vs_ConditionB",
plot_type = "diff_heatmap",
pattern = "all",
palette = "Paired",
top_n = 20,
width = 0.6,
height = 3.5
)
CCCHeatmap(
pancreas_sub,
method = "CellChat",
condition = "ConditionA_vs_ConditionB",
plot_type = "bubble",
sender.use = c("Ductal", "Ngn3-low-EP", "Ngn3-high-EP"),
receiver.use = c("Ductal", "Ngn3-low-EP"),
interaction.use = c(
"MDK_NCL", "CLDN3_CLDN3", "MDK_SDC1", "MDK_ITGA6_ITGB1",
"COL9A2_SDC4", "DLK1_NOTCH1", "GRN_SORT1"
)
)