-
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
Fix back-transformation of ranges in coords #2821
Fix back-transformation of ranges in coords #2821
Conversation
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 changing the name is probably ok; we'll just need to remember to call out in the NEWS for the next release (since it's a breaking change for extension authors) (but I don't think there are many custom coords in the wild)
Can you please also add some text to the Coord
help?
R/coord-.r
Outdated
# back into range in given in (possibly scale-transformed) | ||
# data coordinates | ||
backtransform_range = function(panel_params) { | ||
warning("range backtransformation not implemented in this coord; plot may be wrong.") |
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.
Needs call. = FALSE
5ccca17
to
17822b5
Compare
I have improved the coord documentation, implemented |
All fixes and documentation improvements minus the API change are now in PR #2832, which I think should be merged first. Once that is done I will rebase this PR. |
I made a new label to (hopefully) remind us not to merge until we're done with the bug fix release. |
17822b5
to
f094a43
Compare
…ersion of ggplot2 Originally caused by tidyverse/ggplot2#2832 Need to wait for tidyverse/ggplot2#2821 to be merged. Expecting a bug fix release between 3.0.0 and when this bug will be fixed, so can not compare against pkg versions. :-/
Is it possible to get this in the bug-fix release? The API change from #2832 causes a problem with plot interaction in Shiny, and this PR would fix it. We'd prefer not to add in a workaround for a single version of ggplot2 that has a different API. (@schloerke Please feel free to correct me if I've gotten details wrong.) |
@wch @schloerke Could you file a separate ggplot2 issue explaining exactly what the problem is? I looked at rstudio/shiny#2184 and it's not immediately clear to me why this PR would fix the problem. More fundamentally, I'm concerned that there's a problem with the current ggplot2 that would be resolved with this PR. It suggests to me we haven't fully thought this through. |
56bc199
to
d4be2f1
Compare
@hadley Could you review this once more? I think this is now as much as possible a non-breaking commit:
With these changes, I think it is better to merge this before 3.0.1 than not, since it fixes #2895. I have also provided documentation for the |
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'm not very familiar with this code any more, but the changes seem reasonable to me, and the documentation looks good.
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/ |
This is a starting point for a conversation of how to fix #2149 and #2812. I realize the regression tests don't pass yet.
The key to fixing these bugs is to recognize that the
range()
function inCoord
is meant to back-transform transformed ranges into data coordinates. It is only ever used in this way:and the API only makes sense with this interpretation: The function takes panel ranges as argument and returns ranges. If it doesn't back-transform, what else should it do? Also, it is written in this way for
coord_flip()
andcoord_polar()
already.To make the meaning of the function more explicit, I have renamed it from
range()
tobacktransform_range()
. However, this is a breaking change if any geoms out in the world use this function. Alternatively, we could keep the current (confusing) name and just document better.Reprex with fixed examples follows below. These geoms don't work at all yet with
coord_sf()
, but there appears to be a separate issue that needs to be fixed first (#2820).Created on 2018-08-10 by the reprex package (v0.2.0).