Closed xiangpin closed 1 year ago
Thank you @xiangpin for bringing this up! I will have a close look and do my best to resolve it this weekend at the latest.
I am thoroughly confused about this but still digging in.
First, a couple of issues due to the (i think?) newly introduced 'vctrs_vctr' classes, which do not tolerate slick base R behavior like letters[c(TRUE, FALSE)]
, have been identified and will be easy to resolve.
One remaining problem lies with the pairing of StatAlluvium
and GeomPointrange
. The issue does not arise with GeomLinerange
and only arises when the legend is drawn. I'm trying to figure out whether this patch for this issue is the source, and i'll have to come back to it later.
The remaining problem arises here (introduced in this commit):
#' @export
#' @rdname draw_key
draw_key_pointrange <- function(data, params, size) {
grobTree(
draw_key_linerange(data, params, size),
draw_key_point(transform(data, params, size = (data$size %||% 1.5) * 4))
)
}
Some values in param
, as passed from StatAlluvium
, are NULL
, which produces this error:
> transform(data.frame(a = 1, b = 2), list(c = NULL), d = 4)
Error in data.frame(list(a = 1, b = 2), list(c = NULL), d = 4) :
arguments imply differing number of rows: 1, 0
Maybe this was an oversight at ggplot2, but it may be good hygiene anyway for stats to not pass null parameter values to geoms. The following line in Stat*$setup_params()
(which must be added if missing) solves the problem:
params[vapply(params, is.null, NA)] <- NULL
I plan to raise an issue at ggplot2 (if not already raised), either to remove the bug or to understand why it is a feature.
I think this issue might be introduced by the commit, which introduced vctrs
internally in ggplot2
Wow, that is some commit. I think you're right that the original issue you flagged arose from the use of vctrs, and i think it's resolved in the ggplot2-upgrade
branch.
Testing uncovered another issue, though, described in this issue. It seems like an accident, but i'll wait to see what the developers say (or until the development version is released, in case it's not addressed) before releasing the fix here.
Thank you, I got it.
This seems to have been resolved, as documented in the issue linked above.
Description of the issue
The next version of
ggplot2
will have some changes. But now theggalluvial
is not compatible with the version. You can see the following example.Reproducible example (preferably using
reprex::reprex()
)