-
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
coord_sf() ignores axis label settings #2857
Comments
It turns out this was much easier to fix than I thought. I've made a PR (#2858). |
clauswilke
added a commit
that referenced
this issue
Aug 27, 2018
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/ |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
As mentioned in #2846 (comment), axis labels cannot be set manually when using
coord_sf()
.The reason is that the
setup_panel_params()
function ofcoord_sf()
ignores the break info generated by the scales and instead reads and interprets the scales'breaks
parameters directly:ggplot2/R/sf.R
Lines 450 to 457 in 6500a30
For comparison,
coord_cartesian()
does this:ggplot2/R/coord-cartesian-.r
Line 102 in 6500a30
coord_sf()
is written the way it is because it needs to letsf::st_graticule()
make appropriate decisions about where to put graticules and how to label them, with the knowledge of the CRS that is being used. The scales don't have that knowledge and would in general produce bad breaks and labels.What this means is that if we want to be able to allow manual overriding of labels, we will have to add additional logic to
coord_sf()
/setup_panel_params()
that essentially mimics the scales'get_labels()
function:ggplot2/R/scale-.r
Lines 289 to 309 in 6500a30
Also potentially relevant: r-spatial/sf#829
The text was updated successfully, but these errors were encountered: