-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Reversal of coordinates #6070
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
Merged
Merged
Reversal of coordinates #6070
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Merge branch 'main' into coord_reversal # Conflicts: # R/coord-.R # man/coord_trans.Rd
thomasp85
approved these changes
Dec 2, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Merge branch 'main' into coord_reversal # Conflicts: # R/scale-.R # tests/testthat/test-coord_sf.R
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 #4021 and fix #4801 and fix #5918.
Briefly, several coords get a
reverse
argument that can reverse the x/y/theta/r direction of a coord.Importantly, this PR gets rid of the behaviour that giving the limits in reverse order implies
transform = "reverse"
in the scale, for the following reasons;reverse
argument to get the same effect.The behaviour continues to work in
xlim()
/ylim()
because that is the only place where it is documented.Also worth noting:
coord_radial(direction)
was essentially doing the same thing, but just for 'theta'. This is now deprecated in favour of thereverse
argument that works for both 'theta' and 'r'.guide_grid()
has been rewritten to accommodate coord transformations/munching. This makes plots ~1ms slower to render.coord_radial()
now renders minor gridlines for the 'r' direction, which I didn't even realise were missing in the first place. This is the visual change you see in the snapshots.Alright, some examples then. Reversing a discrete direction:
Showing that we can reverse transformed directions:
Showing that we can reverse directions for
coord_sf()
:Showing reversal for
coord_radial()
. Please note the anti-clockwise direction of 'theta' and outside-in direction of 'r', and preservation of the start/end angles.Created on 2024-09-02 with reprex v2.1.1