Ensure all keys in guide_bins(..., reverse = TRUE)#4442
Merged
Conversation
Comment on lines
+167
to
+172
| if (guide$reverse) { | ||
| key <- key[rev(seq_len(nrow(key))), ] | ||
| # Move last row back to last | ||
| aesthetics <- setdiff(names(key), ".label") | ||
| key[, aesthetics] <- key[c(seq_len(nrow(key))[-1], 1), aesthetics] | ||
| } |
Member
There was a problem hiding this comment.
Can we reverse the bins before appending NA at the bottom?
bin_at <- scale$map(bin_at)
if (guide$reverse) {
bin_at <- rev(bin_at)
}
key <- new_data_frame(setNames(list(c(bin_at, NA)), aes_column_name))
key$.label <- scale$get_labels(all_breaks)
Member
Author
There was a problem hiding this comment.
The issue is that bin_at and the derivatives gets calculated at two different branches so we would have to duplicate the logic there
Member
There was a problem hiding this comment.
bin_atand the derivatives gets calculated at two different branches
I meant something like this, not inside the if branches.
master...yutannihilation:poc/pr-4442
Since I needed some minutes to figure out what the added code does, I was hoping to make the logic simple, but it seems my attempt is no shorter than this pull request... Please ignore my comments.
yutannihilation
approved these changes
Apr 26, 2021
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.
Fix #4210
This fixes a bug when reversing the bin guide because the terminal row that held irrelevant
NAvalues ended up as the first row