Repository navigation
Palettes for discrete scales - #5771
Merged
Merged
Conversation
teunbrand
commented
Mar 12, 2024
| range_continuous = c(-15, -2) | ||
| ), | ||
| c(-15, -2) | ||
| c(-16, -1) |
Collaborator
Author
teunbrand
marked this pull request as draft
March 12, 2024 16:11
Collaborator
Author
|
I've put the palettes in line with palletes elsewhere in that they now require an |
teunbrand
marked this pull request as ready for review
March 22, 2024 08:54
thomasp85
approved these changes
May 15, 2024
thomasp85
left a comment
Member
There was a problem hiding this comment.
LGTM. I dislike the palette name for this functionality, but I guess this is in line with the terminology we have ended up with
Collaborator
Author
Yeah I also don't think it is a great name, but it is consistent with the rest of the scales api |
Merge branch 'main' into discrete_palette # Conflicts: # R/scale-discrete-.R
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
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 #5770.
Briefly, it adds a
paletteargument 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:
palettefunctions that takenas argument. In this PR, palette functions take the limits as arguments. Should I let palettes takenas an argument instead? I think the benefit of the current approach is that one could design a lookup table aspaletteargument.