View source: R/plot-distributions.R
| plot_network_evolution | R Documentation |
Plots a network at different time points side by side. The input is an
edge list data frame with a time column, a cograph_network whose
stored edge data contain such a column, or a list of networks. All panels
share one node layout. At least two periods are required.
plot_network_evolution(
x,
time = NULL,
slices = NULL,
cumulative = FALSE,
labels = NULL,
layout = "spring",
ncol = NULL,
node_size = 5,
seed = 42,
combined = TRUE,
...
)
x |
An edge list data frame with columns |
time |
Character. Name of the time column in |
slices |
Integer or NULL. Number of equal-width bins of the numeric
time column. Default NULL uses the unique time values. Bins work with
|
cumulative |
Logical. If TRUE, each panel shows all edges up to that time point (growing network). If FALSE (default), each panel shows only edges from that period. |
labels |
Character vector of panel labels, one per period. The
default NULL uses the time values, or |
layout |
Character, or a matrix or data frame of coordinates. Any
character value computes one Fruchterman-Reingold layout from the union
of all edges and uses it for every panel. A matrix or data frame gives
the x and y coordinates of the nodes in its first two columns, one row
per node; rows named after the nodes are matched by name, otherwise they
are taken in node order. Default |
ncol |
Integer. Number of grid columns. The default NULL uses
|
node_size |
Numeric. Node size passed to |
seed |
Integer or NULL. Random seed for the shared layout. The caller's random number state is restored on exit. NULL sets no seed. Default 42. |
combined |
Logical. When TRUE (default), the period panels are
arranged in an internal grid via |
... |
Additional arguments passed to |
Invisibly, a list with one element per period. For data frame
input each element is the edge-list data frame of that period (all
earlier periods included when cumulative = TRUE). For list input
it is the input list.
set.seed(1)
edges <- data.frame(
from = sample(c("A", "B", "C", "D", "E"), 30, replace = TRUE),
to = sample(c("A", "B", "C", "D", "E"), 30, replace = TRUE),
week = sample(1:4, 30, replace = TRUE))
cograph::plot_network_evolution(edges, time = "week")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.