Closed timchurches closed 7 years ago
Thank you for the compliment!
If i understand correctly (i had to Google "z-ordering"), the issue is that the z-ordering of two flows influences the color of their overlapping region, so that when multiple flows are interwoven an apple pie–type pattern appears. I've wondered about this—i think the Titanic example in the vignette has this problem—but i haven't figured out how to stop it. Certainly this is an issue that needed to be raised, and i'll look into it.
In the meantime, if the focus of the diagram isn't the alluvia (individual patients) but rather the flows between strata (transitions between RAPS groups), then you could merge the alluvial segments into flows by replacing
geom_flow(stat="alluvium", lode.guidance = "leftright")
with
geom_flow(stat="flow")
This would obviate the issue by having only one overlap between two flows of a given pair of colors.
I tried dplyr::arrange_()
ing the data internally (in StatAlluvium$compute_panel()
) by the aesthetic variables and then redefining the group
variable that geom_alluvial()
uses to plot the alluvia. This way, geom_alluvial()
plots all alluvia of a given fill
(or other aesthetic) value before moving on to the next. For me, it fixes both the example in the vignette and the example you've provided. Give it a try by installing from the new z-ordering branch:
devtools::install_github("corybrunson/ggalluvial", ref = "z-ordering")
Let me know how it goes!
Cory,
Thanks! Firstly, changing to geom_flow(stat="flow") fixed the problem, although the individual alluvia are nice. But the good news is that the fixes on the z-ordering branch completely fix the problem - it's now perfect even when individual alluvia are plotted.
Great! I'll synchronize the ordering with that of stat_flow()
for consistency, then merge the changes into master.
ggalluvial is very nifty! However, I've noticed a few flaws in the flow rendering which look like they might be due to inconsistent z ordering when each flow is drawn (or it may be user error..) - see below:
Data to reproduce this:
Code to reproduce this: