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