An easy way to plot the alluvial by using the columns created by the different function of networkflow.
Usage
plot_alluvial(
alluv_dt,
intertemporal_cluster_column,
node_id,
window_column = "window",
color_column = "color",
color_alluvial = FALSE,
color = NULL,
minimize_crossing = FALSE,
prepare_label = FALSE,
cluster_label_column = "cluster_label",
print_plot_code = FALSE
)
Arguments
- alluv_dt
A data.frame of an alluvial created with networks_to_alluv().
- intertemporal_cluster_column
The column with the identifier of inter-temporal clusters. If you have used add_clusters() and merge_dynamic_clusters(), it is of the form
dynamic_cluster_{clustering_method}
.- node_id
The column with the unique identifier of each node.
- window_column
The column of the alluvial with your time window. By default, "window", as created by networks_to_alluv().
- color_column
The column with the colors associated to the categories of
intertemporal_cluster_column
. By default, "color", as the result of color_alluvial().- color_alluvial
If no color has been set for the categories of
intertemporal_cluster_column
, you can attribute them colors by settingcolor_alluvial
toTRUE
. color_alluvial() will be used.- color
If
color_alluvial
isTRUE
, the parametercolor
will be used to color the categories of theintertemporal_cluster_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 theintertemporal_cluster_column
and a second column with the vector of colors you want to use. IfNULL
colors will be automatically chosen by color_alluvial()?- minimize_crossing
If
TRUE
, minimize_crossing_alluvial() is run to reorder theintertemporal_cluster_colum
to limit overlapping in the plot.- prepare_label
If
TRUE
, prepare_label_alluvial() is used to create a columnlabel_x
with- cluster_label_column
If
prepare_label
isTRUE
, label_alluvial() is used and the values ofcluster_label_column
are taken to be displayed as label. By default, "cluster_label", as it is the default name of the column created with name_clusters(). But you may also use the same column as inintertemporal_cluster_column
.- 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.