Learn R Programming

NAIR (version 1.0.4)

extractLayout: Get Coordinate Layout From Graph Plot

Description

Given a ggraph plot, extract the coordinate layout of the graph nodes as a two-column matrix.

Usage

extractLayout(plot)

Value

A matrix with two columns and one row per network node. Each row contains the Cartesian coordinates of the corresponding node.

Arguments

plot

An object of class ggraph.

Author

Brian Neal (Brian.Neal@ucsf.edu)

Details

Equivalent to as.matrix(plot$data[c("x", "y")]).

References

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

Webpage for the NAIR package

Examples

Run this code

set.seed(42)
toy_data <- simulateToyData()
net <- buildRepSeqNetwork(toy_data, "CloneSeq", print_plots = TRUE)

my_layout <- extractLayout(net$plots[[1]])

# same as `graph_layout` element in the plot list
all.equal(my_layout, net$plots$graph_layout, check.attributes = FALSE)

Run the code above in your browser using DataLab