-
Notifications
You must be signed in to change notification settings - Fork 2.1k
geom_rect()
can derive corners from x
/width
or y
/height
#5862
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
Changes from 10 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
6dc3ba8
required aesthetics to non-missing aes
teunbrand 65030f5
<GeomBar> doesn't inherit `optional_aes`
teunbrand 71923cc
fill missing aes
teunbrand 93b45ad
throw error when unresolveable
teunbrand 99293fd
protect against partial matching
teunbrand e992f51
add tests
teunbrand 68ce1fc
Merge branch 'main' into flexible_rects
teunbrand b083634
add news bullet
teunbrand 984749c
adjust docs
teunbrand 41c6090
fallback for corners wired through `params`
teunbrand 83557d7
Merge branch 'main' into flexible_rects
teunbrand 0581b23
Revert "<GeomBar> doesn't inherit `optional_aes`"
teunbrand 9395341
adapt `check_required_aesthetics()` to deal with multiple or-logic
teunbrand f991ec5
undo aesthetic field voodoo
teunbrand b990a2b
fill data from params more reliably
teunbrand 5d01396
throw error from `resolve_rect()`
teunbrand b79e68e
document
teunbrand 19b36b0
Merge branch 'main' into flexible_rects
teunbrand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
test_that("geom_rect can derive corners", { | ||
|
||
corners <- c("xmin", "xmax", "ymin", "ymax") | ||
full <- data.frame( | ||
xmin = c(1, 2), xmax = c(3, 6), | ||
ymin = c(1, 2), ymax = c(3, 6), | ||
width = c(2, 4), height = c(2, 4), | ||
x = c(2, 4), y = c(2, 4) | ||
) | ||
|
||
test <- full[, c("xmin", "ymin", "width", "height")] | ||
test <- GeomRect$setup_data(test, NULL) | ||
expect_equal(full[, corners], test[, corners]) | ||
|
||
test <- full[, c("xmin", "ymin", "x", "y")] | ||
test <- GeomRect$setup_data(test, NULL) | ||
expect_equal(full[, corners], test[, corners]) | ||
|
||
test <- full[, c("x", "y", "width", "height")] | ||
test <- GeomRect$setup_data(test, NULL) | ||
expect_equal(full[, corners], test[, corners]) | ||
|
||
test <- full[, c("xmax", "ymax", "width", "height")] | ||
test <- GeomRect$setup_data(test, NULL) | ||
expect_equal(full[, corners], test[, corners]) | ||
|
||
test <- full[, c("xmax", "ymax", "x", "y")] | ||
test <- GeomRect$setup_data(test, NULL) | ||
expect_equal(full[, corners], test[, corners]) | ||
|
||
test <- full[, c("x", "y")] | ||
expect_error( | ||
GeomRect$setup_data(test, NULL), | ||
"requires the following missing aesthetics" | ||
) | ||
}) |
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.
Uh oh!
There was an error while loading. Please reload this page.