-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Generalize position_jitterdodge to all possible dodge positions #1494
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
Generalize position_jitterdodge to all possible dodge positions #1494
Conversation
# Adjust the x transformation based on the number of 'fill' variables | ||
nfill <- length(levels(data$fill)) | ||
|
||
width <- self$jitter.width %||% resolution(data$x, zero = FALSE) * 0.4 |
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 fix the indenting?
Looks good apart from a few style problems. |
I fixed all comments. |
|
||
# Adjust the x transformation based on the number of 'dodge' variables | ||
dodgecols <- intersect(c("fill", "colour", "linetype", "shape", "size", "alpha"), colnames(data)) | ||
if (length(dodgecols) == 0) stop("`position_jitterdodge()` requires ", |
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.
It would be more natural to break the line just before stop()
, and I prefer to always put if statements in {}
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.
No problem. Like that?
Perfect - thanks! |
Thanks! |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
So far,
position_jitterdodge()
is limited to boxplots dodged by thefill
aesthetic.This pull request generalizes the function to work properly on all posible dodge aesthetics:
fill
colour
linetype
alpha
size
shape
not that all of these readily make sense to me, but as long as it is supported by boxplot etc. I think it would be good to have this functionality. I for one was trying based on
colour
dodging, when I came upon this.