-
Notifications
You must be signed in to change notification settings - Fork 303
Attribute plot12
in st_graticule() is not documented and not sufficiently general
#828
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
Comments
Actually, when writing code to place arbitrary labels on arbitrary sides of a plot, I realized that an added complexity arises because we don't necessarily know in which direction a graticule runs: |
For reference, this is the ggplot2 pull request that uses this code, with example figures: |
The possibilities are: |
Ah, I hadn't thought about "both", but I can see how it could happen. Could you provide an example that generates such a case? It may be relevant to my discussion with @hadley on this issue: |
@clauswilke is your request still relevant? It's doable, but not like trivial. |
No, not that important. I have revised all my code to allow for this possibility in principle. |
OK, then we can close here? |
While trying to figure out how to address tidyverse/ggplot2#2846 (
coord_sf()
can't draw axis tick labels on the right or top), I found this line in the ggplot2 code:https://github.com/tidyverse/ggplot2/blob/5a37ae7dd590c045d8fe5d01ea66d4e733946713/R/sf.R#L336-L338
which uses the
plot12
attribute fromst_graticule()
:As far as I understand, this attribute is true if an axis tick should be drawn on the left or bottom, and false otherwise. However, this is nowhere documented, as far as I can see. More importantly, this looks to me like a specialized hack. A more general solution would return appropriate attributes for all four sides of the plot. Actually, the most general case requires 8 pieces of information, because each graticule type (N or E) can potentially intersect with any edge of the bounding box. Looking at examples such as the one below (arguably weird) has made me wonder whether there should be a switch to allow labeling E graticules on the y axis and N graticules on the x axis, which would require this info.
Would it be possible to provide more general info about which graticules intersect with which boundaries? And also, would it be possible to document
plot12
?Created on 2018-08-23 by the reprex package (v0.2.0).
The text was updated successfully, but these errors were encountered: