oswaldosantos / ggsn

R package to add north symbols and scale bars to maps created with ggplot or ggmap
http://oswaldosantos.github.io/ggsn/
GNU General Public License v2.0
161 stars 9 forks source link

Include map scale and north arrow to only one ggplot facet #35

Closed rafapereirabr closed 6 years ago

rafapereirabr commented 6 years ago

I am ploting a map using the ggplot2 and sf packages and I would like to include a map scale and north arrow to the figure using the ggsn package. Here is the problem. I want to show a figure with two or more facets but I would like to add the scale and north arrow to only one of the figure facets.

I've detailed my question here. . I'm not sure this should be created as an issue .

oswaldosantos commented 6 years ago

You can use the scalebar arguments facet.var and facet.lev, and north2 function instead of north.

rafapereirabr commented 6 years ago

Thanks for the tip Oswaldo! If I use the north2 function, however, I can't save the plot using ggsave.
Perhaps it would be a good idea to include the facet.var and facet.lev to the north function.

oswaldosantos commented 6 years ago

North symbols are added through annotation_custom and as far as I know, this function does not allow the specification of only one facet. You can replace ggsave by tiff (or png, pdf, etc).

rafapereirabr commented 6 years ago

Ok, that's a good alternative. Thank you, and congrats for the great work in this package! Abraços!

aakarner commented 6 years ago

When I faced this same problem, I was able to set facet.var and facet.lev to get the behavior I wanted. It's easy enough to draw your own north arrow in after the fact using GIMP/Photoshop or some suitable alternative, if all that's holding back a ggsave() is north2.

rafapereirabr commented 6 years ago

Thanks for sharing your experience, Alex. @aakarner . The solution mentioned by @oswaldosantos sounds good enough and there is a reproducible example on SO (here). Oswaldo, it's fine with me if you would like to close this issue.