teunbrand / ggh4x

ggplot extension: options for tailored facets, multiple colourscales and miscellaneous
https://teunbrand.github.io/ggh4x/
Other
533 stars 32 forks source link

facet_wrap2 fails with development version of ggplot2. #79

Closed kollerma closed 1 year ago

kollerma commented 1 year ago

Hello

I'm the maintainer of robustlmm. I've got informed that one of my vignettes fails to build after ggplot2 has been upgraded (https://github.com/kollerma/robustlmm/issues/25). Specifially, it fails for a plot that uses facet_grid2.

I have traced the issue and it seems to be a problem with ggh4x. Probably it copies a function from ggplot2 when it's being built, see https://www.tidyverse.org/blog/2022/09/playing-on-the-same-team-as-your-dependecy/. If I re-install ggh4x after having installed the development version of ggplot2, then things start to work again.

You should be able to replicate the issue by running

source(system.file("simulationStudy/robustnessDiagonal.R",  package = "robustlmm"))

Best, Manuel

teunbrand commented 1 year ago

Hi there,

Thanks for the heads up! You're right, if I build ggh4x with CRAN ggplot2, then update to the RC branch it does give the error. I've traced it back to the following line:

https://github.com/teunbrand/ggh4x/blob/b54fe1cfc917a6deed361f97f3c748e8cff99f75/R/facet_grid2.R#L178

Which, as I just learned, incorporates the combine_vars() function at build-time instead of using the one exported from ggplot2. This is not a difficult problem to fix, though I didn't anticipate ggplot's extension mechanism to work in this way.

Once the RC branch appears finished, I plan to double check if anything in ggh4x needed updating.

Best, Teun

teunbrand commented 1 year ago

I've released a new version of ggh4x that is now on CRAN that should mitigate this issue now and in the future.

kollerma commented 1 year ago

Many thanks!