Model-to-model segment transition alluvial plot
Source:R/segment_plots.R
rack_segment_alluvial_plot.RdCreate an alluvial plot to show how respondents move between
segments across multiple models within a model rack. To change the order of
models, set factor levels in the model_name column accordingly. To create
an alluvial plot for a subset of models (2 for example), simply
dplyr::filter the rack object.
Examples
library(dplyr)
rack_segment_alluvial_plot(example_seg_rack)
# use a different order (reverse)
example_seg_rack %>%
mutate(across(model_name, forcats::fct_rev)) %>%
rack_segment_alluvial_plot()
# flow from nmf_3 to nmf_5
example_seg_rack %>%
filter(model_name %in% c("nmf_3", "nmf_5")) %>%
rack_segment_alluvial_plot()