-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Better handle position aesthetics in params #3666
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
Better handle position aesthetics in params #3666
Conversation
@@ -99,7 +99,7 @@ GeomLinerange <- ggproto("GeomLinerange", Geom, | |||
|
|||
setup_params = function(data, params) { | |||
params$flipped_aes <- has_flipped_aes(data, params, range_is_orthogonal = TRUE) | |||
if (!(params$flipped_aes || all(c("x", "ymin", "ymax") %in% names(data)))) { | |||
if (!(params$flipped_aes || all(c("x", "ymin", "ymax") %in% c(names(data), names(params))))) { |
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.
Just wondering why it tests for x
, ymin
, ymax
but not y
, xmin
, xmax
in params
. Is this correct?
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.
if has_flipped_aes()
returns true it means that it contains y, xmin, and xmax
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.
Ah, Ok, maybe add a quick comment.
R/geom-linerange.r
Outdated
@@ -113,6 +113,7 @@ GeomLinerange <- ggproto("GeomLinerange", Geom, | |||
}, | |||
|
|||
draw_panel = function(data, panel_params, coord, flipped_aes = FALSE) { | |||
browser() |
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.
This looks left over. That's probably why the CI fails.
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.
Oh shit — thanks😅
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.
I can't say I understand all of the logic of this PR (I'm not sufficiently familiar with this code), but generally LGTM.
revdepchecks uncovered an edge case in direction detection if position aesthetics are given outside aes(). This PR correctly looks in both data and params when figuring out direction