View source: R/visualization.R
labelNodes | R Documentation |
Functions for annotating a graph plot to add custom labels to the nodes.
labelNodes(
net,
node_labels,
plots = NULL,
size = 5,
color = "black"
)
addGraphLabels(
plot,
node_labels,
size = 5,
color = "black"
)
net |
A |
plot |
A |
node_labels |
A vector containing the node labels, where each entry is the label for a single node. The length should match the number of nodes in the plot. |
plots |
Specifies which plots in |
size |
The font size of the node labels. Passed to the |
color |
The color of the node labels. Passed to 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.
Labels are added using
geom_node_text()
.
labelNodes()
returns a copy of net
with the specified plots
annotated.
addGraphLabels()
returns
a ggraph
object containing the original plot annotated
with the node labels.
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
set.seed(42)
toy_data <-
simulateToyData(
samples = 1,
sample_size = 10,
prefix_length = 1
)
# Generate network
network <-
buildNet(
toy_data,
seq_col = "CloneSeq",
plot_title = NULL,
plot_subtitle = NULL
)
# Label each node with its receptor sequence
network <- labelNodes(network, "CloneSeq", size = 3)
network$plots[[1]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.