plot_modules {SeqNet} | R Documentation |
Visualize a network and its modules
Description
This function plots a network and highlights the individual modules.
An attempt is made to layout the nodes so that any visual overlaps among modules
correspond to true overlaps in the network, however it is possible that
a node may appear to be in multiple modules in the visualization when it does
not actually belong to multiple modules. If the result of another plot is
provided using the compare_graph
argument, then the layout of this network
will be based on that plot and convex hulls are drawn to trace out the modules;
in this case it is likely that the displayed modules will contain extraneous
nodes.
Usage
plot_modules(
network,
compare_graph = NULL,
as_subgraph = TRUE,
modules = NULL,
node_scale = 4,
edge_scale = 1,
node_color = adjustcolor("orange", 0.5),
group_color = palette.colors(9, "Set 1"),
generate_layout = igraph::nicely,
include_vertex_labels = TRUE,
show_legend = FALSE,
legend_position = "topright",
legend_horizontal = FALSE,
display_plot = TRUE,
...
)
Arguments
network |
A 'network' object to plot. Alternatively, an adjacency or association matrix can be provided, in which case the 'modules' argument should be specified. |
compare_graph |
The plot of another network to use for comparison. |
as_subgraph |
If |
modules |
A list of modules for the network; this is used to provide
a member list of each module when the |
node_scale |
Used for scaling of nodes. |
edge_scale |
Used for scaling of edges. |
node_color |
The color used for the nodes. |
group_color |
A vector of colors used for the modules. |
generate_layout |
A function to generate the layout of a graph; used
if coords is |
include_vertex_labels |
If |
show_legend |
If |
legend_position |
The location of the legend. Can be any one of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" or "center". |
legend_horizontal |
If |
display_plot |
If |
... |
Additional arguments passed to |
Value
A 'network_plot' object for the network. This object can be passed
back into a future call of plot.network
through the
compare_graph
argument, which will setup the plot for easier
comparison between the old graph and the new graph of network
.
Examples
set.seed(1)
# Networks can be plotted with modules highlighted.
nw <- random_network(100)
g <- plot_network(nw)
plot_modules(nw, g) # Overlay convex hulls around modules in previous layout.