Open anassal opened 8 years ago
Unfortunately at this moment it is not possible without modifying the function.
However, the modification should not be too difficult because in fact there is a separate xspline
for each segment (the loops go through rows of the data frame and inter-category segments). The only thing is to come up with a way of specifying the color argument. It could be a n
by k-1
matrix where n
is the number of rows in the data frame and k
is the number of variables plotted.
I will not be able to look into it in the coming weeks though. Pull requests are welcome!
I just pushed an experimental branch matrix-aesthetics to attempt this, using a module to convert each aesthetic input (col
, alpha
, border
, and hide
) to an n
-by-(np-1)
matrix (if it's not one already). In particular, the internal graphical data frame p
is now a list of vectors and matrices instead. It required a lot of other rearrangements of alluvial()
code, though i tried to do as little as possible. It works with the existing examples but i haven't systematically tested it. Once debugged, would this approach make sense for how to allow users to specify segment aesthetics, and be consistent with the overall usage of alluvial?
Thanks. I'll have a look during the weekend. Sounds good.
I spent some time yesterday on improving the data returned by alluvial
so that it is possible/easier to add further elements (like annotations, labels, and so on). It is more and more clear to me that this function deserves a rewrite... Given that I think it would be best to make the code much more modular. My suggestion is then to try to write stuff in separate functions (in package namespace, but not exported) which are then called by alluvial
.
I found modules indispensable in ggalluvial, so i'm fully supportive of that programme. : ) I'll send a PR for the matrix-aesthetics branch once i've systematized some tests.
Many thanks for the great work
Currently, each xspline represents a single row in the source data.frame.
Is it possible to split the xspline into segments, each one between two consequent columns? This would allow assigning different colour to each segment, e.g., depending on the location of the segment in the whole xspline. I need this in my work to highlight transitions between two specific categories.
Regards,
anassal