-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Guides for coord_sf()
#5293
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
Guides for coord_sf()
#5293
Conversation
@clauswilke you have spend the most time with sf - do you have the bandwidth to look at this? |
@thomasp85 Yes, this touches mostly code that I wrote, so I guess I'll have to look at it carefully. I don't remember much of it, but I'll take a look. @teunbrand Two quick items from my end:
|
To be clear: My code already didn't have that many comments. The new code has even fewer. I think the goal should be more comments than my original code had. |
Under the hood,
Yeah this is a fair point and had some problem deciphering which parts were doing what as well. |
Regarding |
I've sprinkled around some comments and improved some variable names. I'm at such familiarity with GIS that I have to google every time what a meridian and parallel is, so bare with me if I get them confused at times. |
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've reviewed it and had two more minor comments. Overall this seems fine to me, though I will say I don't fully understand the guide system. In the long run, this will likely be more maintainable, though, so moving forward in this direction is good.
Thanks for the review Claus! Yeah I suppose the guide system will take some getting used to, but I'd be happy to try to answer any questions you might have. |
This PR aims to fix a problem akin to #3959, but for
coord_sf()
.Briefly,
coord_sf()
was doing its own guide thing, ignoring any user-provided guides.Now, it renders the guides through the guides system.
Less briefly:
To make this work, I had to cast the graticule positions into a viewscale that the guides can use for training.
I was a bit surprised that axis placement is tightly controlled in
coord_sf()
itself, in thatscale_x_continuous(position = "top")
is ignored and just addingguides(x.sec = "axis")
doesn't just set a top axis.Maybe it would be good to allow some flexibility here, but I didn't change that behaviour in this PR.
I'm new-ish to {sf}, so if anybody knows of hairy edge cases I mightn't have thought of, please let me know.
To illustrate:
Created on 2023-05-01 with reprex v2.0.2