corybrunson / ggalluvial

ggplot2 extension for alluvial plots
http://corybrunson.github.io/ggalluvial/
GNU General Public License v3.0
497 stars 34 forks source link

Feature Request: padding between strata #28

Closed jwbeck97 closed 5 years ago

jwbeck97 commented 5 years ago

Description of the feature

In the alluvial package there is some vertical whitespace between strata and this makes is simpler to see what's happening. This could be done by passing a parameter to geom_stratum.

corybrunson commented 5 years ago

Thanks for raising the issue. This was brought to my attention once before (not on GitHub) and is related to #23. The terminology is not consistent from source to source, but i've taken to distinguishing between alluvial diagrams, in which the strata function as stacked histograms so that the vertical axis has a meaningful scale, and Sankey diagrams, which are more flexible and even free-form (see #11).

If you want to preserve the vertical scale, then you can set color = "white", size = 5 (or similar) in geom_stratum() in order to pad the strata of an alluvial diagram. If, on the other hand, you don't need the vertical scale, and you want to separate the strata by gaps, then you can create a Sankey diagram using geom_parallel_sets() in the ggforce package. Does one of those two options suit you?

It would be straightforward to introduce gaps in ggalluvial, though it would not necessarily be quick—for instance, the same "gap" parameter would have to be passed to every layer being used, and handled in a consistent way. My own feeling is that the ggplot2 extensions for alluvial and Sankey diagrams should remain separate. Part of the reason is that the additional flexibility of Sankey diagrams would not translate well to alluvial diagrams (for example, the ability to position "strata" only for a subset of "alluvia" at some axes, as in the example at #11); while i don't think ggforce does this yet, it could be introduced there naturally.

jwbeck97 commented 5 years ago

I think I understand the distinction between an alluvial and Sankey diagram now. I’ll have a look into the ggforce package and see if that something closer to what I had in mind. Thank you very much for your prompt response

Thanks James Beck On 22 Jan 2019, 11:34 AM +1030, Cory Brunson notifications@github.com, wrote:

Thanks for raising the issue. This was brought to my attention once before (not on GitHub) and is related to #23. The terminology is not consistent from source to source, but i've taken to distinguishing between alluvial diagrams, in which the strata function as stacked histograms so that the vertical axis has a meaningful scale, and Sankey diagrams, which are more flexible and even free-form (see #11). If you want to preserve the vertical scale, then you can set color = "white", size = 5 (or similar) in geom_stratum() in order to pad the strata of an alluvial diagram. If, on the other hand, you don't need the vertical scale, and you want to separate the strata by gaps, then you can create a Sankey diagram using geom_parallel_sets() in the ggforce package. Does one of those two options suit you? It would be straightforward to introduce gaps in ggalluvial, though it would not necessarily be quick—for instance, the same "gap" parameter would have to be passed to every layer being used, and handled in a consistent way. My own feeling is that the ggplot2 extensions for alluvial and Sankey diagrams should remain separate. Part of the reason is that the additional flexibility of Sankey diagrams would not translate well to alluvial diagrams (for example, the ability to position "strata" only for a subset of "alluvia" at some axes, as in the example at #11); while i don't think ggforce does this yet, it could be introduced there naturally. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

corybrunson commented 5 years ago

Welcome!

corybrunson commented 5 years ago

Meant to close this issue previously, so closing now!

For reference, i recently wrote this distinction up more carefully in this blog post.