ggalluvial icon indicating copy to clipboard operation
ggalluvial copied to clipboard

`aes.flow = "interpolate"` option for `geom_flow()`

Open corybrunson opened this issue 7 years ago • 5 comments

Interpolate aesthetics along flows (between adjacent axes). The aesthetics should interpolate along the splines at the same rate as the vertical positions.

corybrunson avatar Apr 30 '17 17:04 corybrunson

Interpolation is not incorporated into xsplineGrob, so this would take a great deal of either learning or work. I welcome help but will not be pursuing this option for now. : (

corybrunson avatar Jul 22 '17 22:07 corybrunson

I am wondering if this is what I am after (though your comments seem to imply it is not doable).

I have figured out how to vary the width of a flow from one node to the next; and to adjust the beginning and end to allow for strata with varying widths (width of strata proportional to sample size): image

What I wish to do next is to have the colour of the ends of the flows match the colour of the stratum it abutts to. I have seen this in Riverplot but I have not been able to manage the width variations in Riverplot. Can this colour change be accomplished in ggalluvial? Or is this what you are referring to by the 'aes.flow="interpolate" option?

Must say that I am having a grand old time with ggalluvial - great package. Thank you.

caston60 avatar Apr 10 '19 04:04 caston60

I'm very glad to hear that you're enjoying it. : )

You're right — having the colors of the flows gradually change from the colors of their incident (abutting) strata is exactly what i'd like to be able to do but don't know how. Currently, the splines are rendered using grid::xsplineGrob(), which has no such functionality. An alternative approach would be to construct the splines from smaller segments and polygons and have their colors vary depending on their x position. But this seemed like a poor trade-off to me. Though, if both implementations were done, it might make sense to have a parameter available to the user to choose between them. Does that sound like a good idea to you? (I don't have the bandwidth to work on it right now, but i'd welcome suggestions as well as contributions.)

corybrunson avatar Apr 10 '19 12:04 corybrunson

Imitation is the sincerest of flattery - Colton How does Riverplot achieve the effect?

I am little more than an R user at best - I fudge the numbers until someone else's clever programming does what I want. Got the want ... don't have the how.

caston60 avatar Apr 10 '19 16:04 caston60

Expertise is relative; i don't know how riverplot works myself. The place to begin tinkering is the source code, which is on GitHub: https://github.com/cran/riverplot Good to have the link on this thread, in case anyone reading it wants to give it a try in the meantime. (I may come back to this, but it will be some time.)

corybrunson avatar Apr 10 '19 18:04 corybrunson