paleolimbot / ggspatial

Enhancing spatial visualization in ggplot2
https://paleolimbot.github.io/ggspatial
368 stars 34 forks source link

Add background for scale bars and north arrows. #113

Open lucas-johnson opened 1 year ago

lucas-johnson commented 1 year ago

Thanks for a great package! I use this all the time, and it makes things so much easier.

I'm wondering if you might add a feature to put a solid color behind your scale bars or north arrows, to make them stand out a bit against different datasets.

paleolimbot commented 1 year ago

That is a great idea!

The arrow itself gets created here: https://github.com/paleolimbot/ggspatial/blob/master/R/annotation-north-arrow.R#L148-L157 ...off the top of my head I don't remember how to make a gTree has a background but it's probably something like gTree(..., gp = gpar(fill = "the backround color"))

I probably won't get to implementing this and releasing ggspatial again for a few months. If you're interested in taking a stab at it I'd be happy to review!

paleolimbot commented 1 year ago

...actually, I'm thinking now that the easiest way is a adding grid::rectGrob() with fill = "background color" to the back of the subgrob list 😬