Make a sankey plot
Usage
plot_sankey(
data,
group_var,
capitalise_node_labels = TRUE,
save_png_to = NULL,
png_name = "sankey.png",
nodes_order_from_data = FALSE
)
prep_sankey(
data_alignment,
region,
year,
group_var,
middle_node,
middle_node2 = NULL
)
Arguments
- data
data.frame. Should have the same format as output of
prep_sankey()
and contain columns:"middle_node"
, optionally"middle_node2"
,"is_aligned"
,"loan_size_outstanding"
, and any column implied bygroup_var
.- group_var
Character. Vector of length 1. Variable to group by.
- capitalise_node_labels
Logical. Flag indicating if node labels should be converted into better looking capitalised form.
- save_png_to
Character. Path where the output in png format should be saved
- png_name
Character. File name of the output.
- nodes_order_from_data
Logical. Flag indicating if nodes order should be determined by an algorithm (in case of big datasets often results in a better looking plot) or should they be ordered based on data.
- data_alignment
data.frame. Holds aggregated alignment metrics per company for tms sectors. Must contain columns:
"name_abcd"
,"sector"
and any column implied bygroup_var
.- region
Character. Region to filter
data_alignment
data frame on.- year
Integer. Year on which
data_alignment
should be filtered.- middle_node
Character. Column specifying the middle nodes to be plotted in sankey plot. Must be present in
data_alignment
.- middle_node2
Character. Column specifying the middle nodes to be plotted in sankey plot. Must be present in
data_alignment
.