I need to create a particular type of plot using ggalluvial. From the vignette of the package:
require(ggalluvial)
data(vaccinations)
vaccinations <- transform(vaccinations,
response = factor(response, rev(levels(response))))
ggplot(vaccinations,
aes(x = survey, stratum = response, alluvium = subject,
y = freq,
fill = response, label = response)) +
scale_x_discrete(expand = c(.1, .1)) +
geom_flow() +
geom_stratum(alpha = .5) +
geom_text(stat = "stratum", size = 3) +
theme(legend.position = "none") +
ggtitle("vaccination survey responses at three points in time")
Gives this plot:
Now, I need to produce a plot in which two different "flows" from the first block of nodes "merge" (or converge) on the same portion of another node in the first block (for example, the flows from "always" and "sometimes" converge on the same part on the "always" second block). Obviously, the frequencies would be different from the first block and the second block of nodes.
I've tried to manipulate the database changing frequencies, but it seems there is no way to make two flows "converge" on the same section of the end node.
Anyone have a guess?
EDIT: To answer to the comment, this is the output that I have in mind (taken from another answer, here: Create Sankey/ Alluvial diagram in which the links combine at the node):
In which two "flow" (from the red and the green boxes) "converge" on the pink box (occupying the same place on the pink box).