-
Notifications
You must be signed in to change notification settings - Fork 24
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
Labelled contour lines #27
Comments
Haha, that made me chuckle! On a note that just occurred to me looking at the plot, do we want to make the 'padding'/'breathing room' adjustable? |
I thought we had made padding adjustable, but I see now that we haven't. It's certainly a parameter within some of the internal functions, so it should be easy enough to expose it to end-users. I think the labelling looks good as-is. The only thought that occurs is that you might want the label appearing more than once on the path. This ties in with something you mentioned before about having repeated labels along a path. This would be a nice additional feature, but it would be a bit of a headache to implement, requiring an overhaul of The examples I have added to the readme demonstrate both I was thinking more of a convenience wrapper geom, but not sure how necessary that is. |
Well the repeated label thing I had I mind would be as easy as:
Wherein the A convenience wrapper sounds nice if you're motivated to make one (but no pressure, it is not an essential feature, I think). If you're looking for some inspiration, the metR package also has some contour labelling options. |
I have now exposed the padding argument in The main feature that metR seems to offer is that it places the label on the flattest part of the curve. I'm not sure how big a difference this makes, but if there was an algorithm to do that for general paths and not just contours, we might be able to have a (?default) "auto" setting on the hjust in the that tries to put the labels in a nice spot. I'm not sure how hard this will be, but again the curvature might help us here. |
Isn't searching for the flattest part of a curve equivalent to finding the angles that are closest to zero or multiples of 2*pi? If you want to get more fancy, you can search in a textwidth-sized window for the smallest average absolute angle. It could be nice to have this for regular |
Yes, that's what I was thinking - perhaps allowing an "auto" hjust to be interpreted as "place the text on the flattest part of the path". Though, having said that, it seems a shame to write a package for curved text only to have it default to flat text! |
Well we can just make |
I have implemented |
One of the things I had hoped this package would handle would be labelled contour lines, where there are breaks in the lines for the labels. This is something that comes up now and again on SO, and none of the existing solutions seem that great.
I was about to explore how we might implement this, when I realized that...we already have:
I think we want to include an example like this in our readme and gallery, but the issue is: is this useful enough to warrant its own geom? It would be very little work to create since it's essentially already implemented.
Created on 2021-12-07 by the reprex package (v2.0.0)
The text was updated successfully, but these errors were encountered: