set_layout: Set Layout in Cograph Network

View source: R/class-network.R

set_layoutR Documentation

Set Layout in Cograph Network

Description

Sets the layout coordinates in a cograph_network object. Updates the x and y columns in the nodes data frame.

Usage

set_layout(x, layout_df)

Arguments

x

A cograph_network object.

layout_df

A data frame with x and y columns, or a matrix with 2 columns.

Value

The modified cograph_network object.

See Also

as_cograph, get_nodes, sn_layout

Examples

mat <- matrix(c(0, 1, 1, 1, 0, 1, 1, 1, 0), nrow = 3)
net <- as_cograph(mat)
layout <- data.frame(x = c(0, 1, 0.5), y = c(0, 0, 1))
net <- set_layout(net, layout)
get_nodes(net)

cograph documentation built on April 1, 2026, 1:07 a.m.