Issue #51 may have been resolved by using the aes.bind parameter. However, experiments with other solutions have exposed a shortcoming of the lode.ordering parameter. Currently, lode.ordering expects a vector of unique values, in fact a permutation of seq(nrow(data)), as might be output by order(). If a vector with repeated values is passed to lode.ordering, then the result may depend on the order of the rows of data. (The problem and solution both translate directly to passing a matrix to lode.ordering.)
An improvement would be for stat_alluvium() to treat such a vector in the same way that it currently treats the aesthetic variables when aes.bind = "alluvia"—that is, to sort the alluvia first by the vector passed to lode.ordering and then by the "deposits" that encode the orders of the strata at the other columns, in the sequence prescribed by the lode guidance function. In this revision, both lode.guidance and lode.ordering could be used together to determine the order of the lodes.
The plots below illustrate the present shortcoming. In each step that uses lode.ordering, the ordering vector is reversed for consistency with the rest of the plot. (Should this be done internally? It would be a breaking change.) An ordering vector that recovers the plot using aes.bind = "alluvia" is only obtained via a cumbersome dplyr composition. The revised behavior would obviate this step and instead recover the plot by simply using lode.ordering = data$V.
Issue #51 may have been resolved by using the
aes.bind
parameter. However, experiments with other solutions have exposed a shortcoming of thelode.ordering
parameter. Currently,lode.ordering
expects a vector of unique values, in fact a permutation ofseq(nrow(data))
, as might be output byorder()
. If a vector with repeated values is passed tolode.ordering
, then the result may depend on the order of the rows ofdata
. (The problem and solution both translate directly to passing a matrix tolode.ordering
.)An improvement would be for
stat_alluvium()
to treat such a vector in the same way that it currently treats the aesthetic variables whenaes.bind = "alluvia"
—that is, to sort the alluvia first by the vector passed tolode.ordering
and then by the "deposits" that encode the orders of the strata at the other columns, in the sequence prescribed by the lode guidance function. In this revision, bothlode.guidance
andlode.ordering
could be used together to determine the order of the lodes.The plots below illustrate the present shortcoming. In each step that uses
lode.ordering
, the ordering vector is reversed for consistency with the rest of the plot. (Should this be done internally? It would be a breaking change.) An ordering vector that recovers the plot usingaes.bind = "alluvia"
is only obtained via a cumbersome dplyr composition. The revised behavior would obviate this step and instead recover the plot by simply usinglode.ordering = data$V
.Created on 2020-04-02 by the reprex package (v0.3.0)