View source: R/visualization.R
labelClusters | R Documentation |
Functions for labeling the clusters in network graph plots with their cluster IDs. The user can specify a cluster-level property by which to rank the clusters, labeling only those clusters above a specified rank.
labelClusters(
net,
plots = NULL,
top_n_clusters = 20,
cluster_id_col = "cluster_id",
criterion = "node_count",
size = 5, color = "black",
greatest_values = TRUE
)
addClusterLabels(
plot,
net,
top_n_clusters = 20,
cluster_id_col = "cluster_id",
criterion = "node_count",
size = 5,
color = "black",
greatest_values = TRUE
)
net |
A |
plots |
Specifies which plots in |
plot |
A |
top_n_clusters |
A positive integer specifying the number of clusters to label. Those with the
highest rank according to the |
cluster_id_col |
Specifies the column of |
criterion |
Can be used to specify a cluster-level network property by which to rank the
clusters. Non-default values are ignored unless |
size |
The font size of the cluster ID labels. Passed to the |
color |
The color of the cluster ID labels. Passed to the |
greatest_values |
Logical. Controls whether clusters are ranked according to the greatest or
least values of the property specified by the |
The list net
must contain the named elements
igraph
(of class igraph
),
adjacency_matrix
(a matrix
or
dgCMatrix
encoding edge connections),
and node_data
(a data.frame
containing node metadata),
all corresponding to the same network. The lists returned by
buildRepSeqNetwork()
and
generateNetworkObjects()
are examples of valid inputs for the net
argument.
labelClusters()
returns a copy of net
with the specified plots
annotated.
addClusterLabels()
returns an annotated copy of plot
.
Brian Neal (Brian.Neal@ucsf.edu)
Hai Yang, Jason Cham, Brian Neal, Zenghua Fan, Tao He and Li Zhang. (2023). NAIR: Network Analysis of Immune Repertoire. Frontiers in Immunology, vol. 14. doi: 10.3389/fimmu.2023.1181825
addClusterMembership()
,
getClusterStats()
,
generateNetworkGraphPlots()
set.seed(42)
toy_data <- simulateToyData()
network <- buildRepSeqNetwork(
toy_data, "CloneSeq",
cluster_stats = TRUE,
color_nodes_by = "cluster_id",
color_scheme = "turbo",
color_legend = FALSE,
plot_title = NULL,
plot_subtitle = NULL,
size_nodes_by = 1
)
network <- labelClusters(network)
network$plots$cluster_id
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.