-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Expose position arg on geom_hline() and geom_vline() #4286
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
Expose position arg on geom_hline() and geom_vline() #4286
Conversation
Have you tested how this behaves with other positions than |
Hmm, no. And, sorry, I think I tested this quickly with the similar code to #4285 (comment) and thought it works, but it was probably just I forgot to change library(ggplot2)
mydata <- data.frame(
x = factor(c("1", "2", "3")),
y = c(3, 4, 5)
)
mydata$splits <- factor(mydata$x, labels = c("baseline", "Cycle 1", "Cycle 1"))
devtools::load_all("~/repo/ggplot2/")
#> ℹ Loading ggplot2
pos <- position_nudge(x = -0.1)
# works
ggplot(mydata, aes(x, y)) +
geom_point(size = 3, position = pos) +
geom_vline(
aes(xintercept = as.numeric(x)),
alpha = 0.2, size = 5,
colour = "red",
position = pos
) # doesn't work
ggplot(mydata, aes(x, y)) +
geom_point(size = 3, position = pos) +
geom_vline(
aes(xintercept = x),
alpha = 0.2, size = 5,
colour = "red",
position = pos
)
#> Warning in Ops.factor(x, params$x): '+' not meaningful for factors
#> Warning: Removed 3 rows containing missing values (geom_vline). Created on 2021-03-25 by the reprex package (v1.0.0) |
@yutannihilation do you think it is feasible to have this PR done this week? I'm beginning to wrap up the patch release |
Sorry, I'm afraid I can't... I thought this was as easy job as just exposing the argument, but it turned this requires a better understanding about how position works, which I don't know yet. |
No problem - I've moved all other position related issues to next release because it seems to be a huge work getting it all fixed coherently |
I see, thanks for handling the release! |
@yutannihilation do you still think this is worth finishing off? |
Yes, but I don't think I can finish this soon. I'm giving up for now, sorry. |
No problems — thanks for giving it a go! |
The issue in #4286 (comment) is that @yutannihilation Is there any chance I could convince you to revive this PR? If you don't have a luxurious amount of free time on your hands I wouldn't mind recreating it anew. |
Oh, thanks. I just quit my job today so I only have free time in theory :) Let me try this again. Though I couldn't keep up with the recent evolution of ggplot2, I hope I can adjust myself. |
I hope this was by choice and works out in your favour!
I'd be glad to help out any way I can, e.g. if you have questions.. There isn't any hurry in this, but I think this PR is the right solution for the problem. |
Thanks. It's my choice, so don't worry about me. I hope I'll start addressing on this next week! |
Fix #4285