plot_network_diff {SeqNet}R Documentation

Plot the difference between two networks

Description

This function plots the difference in connectivity between two networks. For two identical networks, the graph will be empty. For non-identical networks, black edges are shared by both networks but differ in magnitude or direction (if the networks are weighted), tan edges are in network_1 but not network_2, and red edges are in network_2 but not network_1. All edges are scaled according to the strongest association in either network.

Usage

plot_network_diff(
  network_1,
  network_2,
  compare_graph = NULL,
  as_subgraph = FALSE,
  node_scale = 4,
  edge_scale = 1,
  node_color = adjustcolor("orange", 0.5),
  edge_colors = c("black", "wheat", "red"),
  generate_layout = igraph::nicely,
  include_vertex_labels = TRUE,
  ...
)

Arguments

network_1

A 'network' or 'matrix' object.

network_2

A 'network' or 'matrix' object.

compare_graph

The plot of another network to use for comparison.

as_subgraph

If TRUE, only nodes of positive degree will be shown.

node_scale

Used for scaling of nodes.

edge_scale

Used for scaling of edges.

node_color

The color used for the nodes.

edge_colors

A vector of three colors used for edges; the first colors edges common to both network, the second colors edges in network_1 but not network_2, and the third colors edges that are in network_2 but not network_2. Default is c("black", "wheat", "red").

generate_layout

A function to generate the layout of a graph; used if coords is NULL. See layout_ from igraph for details. Other options include as_star, in_circle, and with_fr, among many others.

include_vertex_labels

If TRUE, the verticies will be labeled.

...

Additional arguments passed to plot.igraph.

Value

Creates a plot of the network and returns a graph object. The graph object can be passed back into a future call of plot_network, plot_network_diff, or plot_network_sim through the compare_edge argument, which will setup the plot for easier comparison between the old graph and the graph of network.

Examples

# Create two networks, the second being a perturbation of the first.
nw1 <- random_network(20)
nw2 <- perturb_network(nw1, n_nodes = 5)
# Can compare networks by plotting each using the same layout.
g <- plot(nw1)
plot(nw2, g)
# Or, the differential network can be plotted.
plot_network_diff(nw1, nw2, g)

[Package SeqNet version 1.1.3 Index]