Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update metR for incoming ggplot2 version #185

Merged
merged 5 commits into from Jan 20, 2024
Merged

Update metR for incoming ggplot2 version #185

merged 5 commits into from Jan 20, 2024

Conversation

teunbrand
Copy link
Contributor

@teunbrand teunbrand commented Jan 19, 2024

Hi Elio,

We have been preparing a new release of ggplot2 and during a reverse dependency check, it became apparent that the prospective ggplot2 3.5.0 would break metR.

In a sense, this PR is a follow-up on #177 in that it aims to make metR compatible with both the old an new versions of ggplot2. A few things of note:

  • makeContent.labelgrob was removed from ggplot2, so this PR provides a facsimile for rendering metR's labels.
  • Scales no longer censor out-of-bounds breaks. This responsibility falls now on guides, which is what the changes to guide_colorstrip() deal with.
  • The changes in guide_vector() are in lockstep with changes to guides in ggplot2 since Guide methods #177.
  • The scale_name field in scales is deprecated, so geom_arrow() now checks the transformation's name for detecting date scales.

To test the code changes with the release candidate, you can install it with the code below:

remotes::install_github("tidyverse/ggplot2", ref = remotes::github_pull("5592"))

The release of ggplot2 3.5.0 is scheduled for the 12th of February. The progress of the release can be tracked in tidyverse/ggplot2#5588. We hope that this PR might help metR get out a fix if necessary.

@eliocamp
Copy link
Owner

Thank you! Looks good.

What is the best source to learn about the guide system? I had to fumble around the source code before and now that things are changing, I probably don't understand half of what's going on.

@eliocamp eliocamp merged commit 5f1e649 into eliocamp:master Jan 20, 2024
5 of 6 checks passed
@teunbrand
Copy link
Contributor Author

Yeah there still isn't good guide to guides. I suppose the Guides section of the ggproto documentation is the closest thing, which you can find here. There is also this WIP blog post that talks about it a little bit.

The currently tricky bit about the guides in metR is that they maintain compatibility with both old and new versions of ggplot2, so it is a bit of a Frankenstein's monster between the S3 and ggproto systems. If you at some point decide to bump the required version of ggplot2 to >= 3.5.0, you wouldn't have to deal with the S3 part anymore.

@eliocamp
Copy link
Owner

If you at some point decide to bump the required version of ggplot2 to >= 3.5.0, you wouldn't have to deal with the S3 part anymore.

Yes. What I actually need to do is to move all the ggplo2-extension stuff to another package and have that package follow ggplot2, while the other functionality can be agnostic to ggplot2 versions.

@teunbrand
Copy link
Contributor Author

That makes sense to me. This is just friendly reminder that the release is due soon.

@eliocamp
Copy link
Owner

eliocamp commented Feb 9, 2024

New version of metR is now on CRAN 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants