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 #5770.
Briefly, it adds a
palette
argument to discrete scales that can be used to customise the position discrete variables are placed in.Demonstrations perhaps show off the functionality better than text descriptions.
The reprex from the issue works:
You can use the palette to invert the order:
If two limits share a position, position adjustments treat these like a single position (invoking dodging in the example) but axis guides show duplicated labels.
Invalid palette output is checked:
When mixing the discrete scale with continuous values in a different layer;
The continuous values stay as-is
Created on 2024-03-12 with reprex v2.1.0
There are at this moment two outstanding issues:
palette
functions that taken
as argument. In this PR, palette functions take the limits as arguments. Should I let palettes taken
as an argument instead? I think the benefit of the current approach is that one could design a lookup table aspalette
argument.