Miscellaneous improvements to guides #5345
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims to fix a series of backward compatibility issues that the
GuideOld
class didn't (perfectly) solve, in addition to a few polishes. It originates from a reverse dependency check which revealed what issues packages have with the guide system. This exercise has surfaced some problems that are being addressed in this PR. The main issues I have found are:NextMethod()
class inheritance. Since we've gutted these in ggplot2, we had anticipated that these needed to be reimplemented in the package extensions themselves. This is mostly handled in PRs towards these packages.guides()
throw an error with empty or unnamed input. Some of the packages relied onguides() == NULL
, which is now the case, whereas others provided unnamed guides, which is now a warning instead of an error.g <- guides(colour = "colourbar")
would store the information ing$colour
, whereas this information is now stored ing$guides$colour
and variations of this. This also has been addressed in PRs to those packages.All in all, surveying this has led to the following PRs that are ready for review:
guide_rampbar()
compatibility with ggplot2 >3.4.2 mjskay/ggdist#186And PRs that rely on fixes in this PR to become ready for review:
guide_level()
compatibility with ggplot2 >3.4.2 mitchelloharawild/distributional#92Unrelated to this PR: besides issues with the guide system, it was also common to see the
expect_equal(length(plot), 9)
in tests, which should now be 10, or the direct borrowing of internals that we've superseded.