plot_graphs: Easily graph a set of networks with sensible defaults

plot_graphsR Documentation

Easily graph a set of networks with sensible defaults

Description

This function provides users with an easy way to graph lists of network data for comparison.

It builds upon this package's graphr() function, and inherits all the same features and arguments. See graphr() for more. However, it uses the {patchwork} package to plot the graphs side by side and, if necessary, in successive rows. This is useful for lists of networks that represent, for example, ego or component subgraphs of a network, or a list of a network's different types of tie or across time. By default just the first and last network will be plotted, but this can be overridden by the "waves" parameter.

Where the graphs are of the same network (the same nodes in the same order), the graphs may share a layout to facilitate comparison. By default, successive graphs will use the layout calculated for the "first" network, but other options include the "last" layout, or a mix, "both", of them.

Usage

graphs(netlist, waves, based_on = c("first", "last", "both"), ...)

Arguments

netlist

A list of manynet-compatible networks. This can also be a single manynet network object that encodes time, which is split automatically (as in grapht()) by manynet::to_times() into the network as it stood at each moment it records: longitudinal or changing networks into waves, dynamic (time-stamped, event-based) networks such as manynet::irps_nuclear into the state accumulated by each moment, and interval (spell) networks that record tie begin/end lifespans, such as manynet::irps_wwi, into one snapshot per change point. It can also be a diffusion model result from e.g. manynet::play_diffusion(). A network of places with a record of moves, as from manynet::play_mobility(), is drawn at the start, the middle, and the last move, coloured by the attribute of the occupants, with the empty places blank. For such a network, waves select the steps, where 1 is the start. A single network that encodes no time is drawn with graphr().

waves

Numeric, the number of plots to be displayed side-by-side. If missing, the number of plots will be reduced to the first and last when there are more than four plots. This argument can also be passed a vector selecting the waves to plot.

based_on

Whether the layout of the joint plots should be based on the "first" or the "last" network, or "both".

...

Additional arguments passed to graphr().

Value

Multiple ggplot2::ggplot() objects displayed side-by-side.

See Also

Other mapping: check_layout, completion, layout_concentric(), layout_configuration(), layout_correspondence(), layout_layered(), layout_levels(), layout_matching(), layout_scaling(), layout_spatial(), layout_valence(), plot_graphr, plot_grapht

Examples

#graphs(to_egos(ison_adolescents))
#graphs(to_egos(ison_adolescents), waves = 8)
#graphs(to_egos(ison_adolescents), waves = c(2, 4, 6))
#graphs(play_diffusion(ison_adolescents))

autograph documentation built on Nov. 16, 2026, 5:08 p.m.