An easy way to plot your networks by using the columns created by the different function of networkflow.
Usage
plot_networks(
graphs,
x = "x",
y = "y",
cluster_label_column = "cluster_label",
node_size_column = "node_size",
color_column = "color",
color_networks = FALSE,
color = NULL,
print_plot_code = FALSE
)
Arguments
- graphs
A tibble graph from tidygraph or a list of tibble graphs.
- x, y
The columns of your tibble graph or list of tibble graphs with the x and y coordinates of your nodes (for instance, the coordinates produce by layout_networks()).
- cluster_label_column
The values of the column are taken to be displayed as labels. By default, "cluster_label", as it is the default name of the column created with name_clusters(). But you may also use the column produced with add_clusters().
- node_size_column
The column with numeric values to be used for the size of nodes. By default, "node_size", as the column created by build_dynamic_networks() or build_network() when
compute_size
set toTRUE
in these functions. IfNULL
, the size of every nodes is set to 1.- color_column
The column with the colors associated to the categories of
cluster_label_column
. By default, "color", as the result of color_networks().- color_networks
If no color has been set for the categories of
cluster_label_column
, you can attribute them colors by settingcolor_networks
toTRUE
. color_networks() will be used.- color
If
color_networks
isTRUE
, the parametercolor
will be used to color the categories of thecluster_label_column
. It may be a vector of colors (in a character format) or a two columns data frame with the first column as the distinct observations of thecluster_label_column
and a second column with the vector of colors you want to use. IfNULL
colors will be automatically chosen by color_networks().- print_plot_code
Set to
TRUE
if you want the ggplot2 code to be printing. It is useful if you are not totally satisfied of the plot and want to manipulate the code yourself.
Details
If you have not used prepare_label_networks(),
the function will be automatically used to produce coordinates to each category of
cluster_label_column
.