Closed teunbrand closed 4 months ago
Thanks! It could be a good alternative. The reason I implemented a single arrow legend is that this is how I often see it in the papers I read in atmospheric science. But other disciplines might have other conventions, so ~adding this option might be useful for them.~
Wait, no, scratch that. This implementation would also allow the user to plot only one arrow by customising the breaks, right? In that case, I should probably switch to this.
This implementation would also allow the user to plot only one arrow by customising the breaks, right?
Yes that's right. You control scale_mag()
and you could have it just return 1 break by default.
I don't know the conventions of your field, so I can't really judge in any meaningful capacity.
Major caveat though is that this won't work in ggplot2 <3.5.0.
That's great. I will defer this to a bit later after 3.5.0 is updated, then.
That's great. I will defer this to a bit later after 3.5.0 is updated, then.
The arrow drawn is solid, but the legend is indeed hollow. How to solve this problem? Make the default legend the same as the one drawn.
This is now implemented! It limits some of the flexibility, but I think it's a much better fit for ggplot2.
When using
geom_vector() + scale_mag()
, you get a legend displaying the magnitude. This is fine, but I can imagine maintainingguide_vector()
might be a bit of a hassle (certainly given recent guide kerfuffle).So the suggestion I'd like to put out there, is that you can use a gimmick in ggplot2 >3.5.0 that lets you assign size to legend glyphs. That way, you can just use regular legends and you're able to display multiple breaks if needed. As a quick and dirty demo, here is how that might work:
Created on 2024-01-19 with reprex v2.1.0
No need to implement this of course, but as I've been rummaging around metR this idea struck me and thought I'd share.