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4 time points (Baseline, Week1, Week2, and Week3), at each time point each patient (individual rows) had been diagnosed to either be positive (1) or negative (0).
I have made a sankey diagram:
<code>df <- sankey_proportions %>%
make_long(Baseline, Week1, Week2, Week3)
ggplot(df, aes(x = x,
next_x = next_x,
node = node,
next_node = next_node,
fill = factor(node),
label = node)) +
geom_sankey(flow.alpha = 0.5,
node.color = 0.5,
width = 0.05) +
scale_fill_viridis_d(alpha = 0.7) +
theme_sankey(base_size = 10)
</code>
<code>df <- sankey_proportions %>%
make_long(Baseline, Week1, Week2, Week3)
ggplot(df, aes(x = x,
next_x = next_x,
node = node,
next_node = next_node,
fill = factor(node),
label = node)) +
geom_sankey(flow.alpha = 0.5,
node.color = 0.5,
width = 0.05) +
scale_fill_viridis_d(alpha = 0.7) +
theme_sankey(base_size = 10)
</code>
df <- sankey_proportions %>%
make_long(Baseline, Week1, Week2, Week3)
ggplot(df, aes(x = x,
next_x = next_x,
node = node,
next_node = next_node,
fill = factor(node),
label = node)) +
geom_sankey(flow.alpha = 0.5,
node.color = 0.5,
width = 0.05) +
scale_fill_viridis_d(alpha = 0.7) +
theme_sankey(base_size = 10)
I would like to have shown absolute counts or proportions in each node, I guess the function has to calculate it for itself to make the plot, but did not find any of this in the vignette.