The Assignment2 package provides a function,
plot_sankey_diagram()
, for creating Excel‑style Sankey
diagrams using ggplot2.
This vignette demonstrates how to recreate the provided Excel Sankey
chart visualizing stroke risk factors over time.
The package includes an example dataset, stroke_data
,
which matches the structure of the Excel file.
You can toggle gaps by setting vertical_gap
or
horizontal_gap
to TRUE
.
For very small proportions, set a minimum ribbon size so that labels
are easier to read.
(Default minimum ribbon size is set to 0.06.)
This vignette demonstrates how the plot_sankey_diagram()
function replicates the Excel Sankey chart style in R.
You can customize:
- **Colors** (by editing the function’s color scale)
- **White space** (with `vertical_gap` and `horizontal_gap`)
- **Ribbon visibility** (with `min_ribbon_size`)
For further styling, you can apply additional ggplot2
themes or save your plots with ggsave()
.