-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Shapes provided via strings instead of integers #2338
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 all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
a12f81a
Add shape string translate function
daniel-barnett 46b3d79
Call translate_shape_string from geom_point if shape is a character
daniel-barnett 92ad484
Call translate_shape_string from scale_shape_manual if character
daniel-barnett f8812b7
Tidy-up/changing pch strings
daniel-barnett 8f6bae3
Updated NEWS.md
daniel-barnett d874a8c
Sryle fixes
daniel-barnett 69af1f6
Style fixes
daniel-barnett 02a19ec
Remove paste() from stop()
daniel-barnett 6d7dab9
Update translate_shape_string() function
daniel-barnett 0ea30b3
Remove shape string translation from manual scales (is superfluous)
daniel-barnett f160450
Add shape string translation to draw_key_point()
daniel-barnett a96f312
Strip names from translated shape integer vector
daniel-barnett bea09d6
translate_shape_string() tests
daniel-barnett d2de3eb
Merge branch 'master' of https://github.com/daniel-barnett/ggplot2
daniel-barnett f3948a8
Merge remote-tracking branch 'upstream/master'
daniel-barnett ec64f9c
Rename shape translate test file
daniel-barnett 487b603
Fix style
daniel-barnett d8dadce
Adhere to error message guidelines
daniel-barnett 4e79af7
Remove superfluous tests and merge two tests for invalidity
daniel-barnett aee9b47
Merge remote-tracking branch 'upstream/master'
daniel-barnett 4cac31d
Adjust geom-point tests
daniel-barnett acf9f18
Remove merge remnants
daniel-barnett 2916e40
Add "triangle square" as an alias for "square triangle" shape
daniel-barnett 8e9e09f
Add shape name example in aesthetic vignette
daniel-barnett 747cf63
Quick formatting adjustments
daniel-barnett 044de3e
Merge remote-tracking branch 'upstream/master'
daniel-barnett 1aa5a04
Replace startsWith for <= 3.2 compatibility
daniel-barnett 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
context("geom-point") | ||
|
||
test_that("single strings translate to their corresponding integers", { | ||
expect_equal(translate_shape_string("square open"), 0) | ||
}) | ||
|
||
test_that("vectors of strings translate to corresponding integers", { | ||
shape_strings <- c( | ||
"square open", | ||
"circle open", | ||
"square open", | ||
"triangle open" | ||
) | ||
|
||
expect_equal(translate_shape_string(shape_strings), c(0, 1, 0, 2)) | ||
}) | ||
|
||
test_that("single characters are not translated to integers", { | ||
expect_equal(translate_shape_string(letters), letters) | ||
expect_equal(translate_shape_string(as.character(0:9)), as.character(0:9)) | ||
}) | ||
|
||
test_that("invalid shape names raise an error", { | ||
expect_error(translate_shape_string("void"), "Can't find shape name") | ||
expect_error(translate_shape_string("tri"), "Shape names must be unambiguous") | ||
}) |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please follow the standard tidyverse style here? (Main problem is that
)
should go on own line; you can use styler package to do automatically)