-
Notifications
You must be signed in to change notification settings - Fork 2k
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
breaks
argument in stat_contour()
accepts function.
#2320
Conversation
This is workable as is, but I'm still arguing with myself whether to pass only the range of the data or also |
I think it should pass |
Using |
I'm not saying you should change it; I'm saying that it would match the existing internal API. |
R/stat-contour.r
Outdated
@@ -31,26 +43,23 @@ stat_contour <- function(mapping = NULL, data = NULL, | |||
#' @usage NULL | |||
#' @export | |||
StatContour <- ggproto("StatContour", Stat, | |||
required_aes = c("x", "y", "z"), | |||
default_aes = aes(order = ..level..), | |||
required_aes = c("x", "y", "z"), |
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 preserve the existing indentation?
R/stat-contour.r
Outdated
compute_group = function(data, scales, bins = NULL, binwidth = NULL, | ||
breaks = breaks_default, | ||
complete = FALSE, na.rm = FALSE) { | ||
# Check is.null(breaks) for backwards compatibility |
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 think we've gone off the rails a bit here because I wasn't clear exactly what I was thinking. I'd prefer not to make such a big change and instead of breaks
is a function, call it like fullseq
with the range of the data and the binwidth.
Sorry about the indent. 😅 I hope this is better. I still think the previous default behaviour (when all arguments are Are you open to removing |
@clauswilke whenever you have the time, can you give this PR a look and see if it should be put in line for the next feature release (since you "own" contouring around here😄) |
Yes. I see this is a really old PR though, and the underlying code has changed a lot. @eliocamp Are you willing to take this back up and make it workable with the current code base? |
Hi @eliocamp This PR was closed as part of our default branch renaming efforts. Since the PR appeared to be stalled I'll keep it closed since it requires a bit of work to resurrect it. If you feel like taking a second stab at this, please open a new PR (and make sure to update your ggplot2 fork to point to the new 'main' branch (using |
Extended the
breaks
argument ofstat_contour()
to accept a function (similar tobreaks
inscale_x_continuous()
).Also, created
breaks_default()
which is the default function for creating breaks. The rational being to give the user easy access to the default behaviour so they can use it as the starting point for a newbreaks
function or small modifications. For example:Also added documentation to
bins
andbinwidth
.