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

Custom positioning of scalebar #42

Closed PaulLantos closed 5 years ago

PaulLantos commented 5 years ago

Hi Oswaldo, I was wondering if it's possible to place this scalebar off the face of the map; I'd like to place it more visibly and off the map where it won't interfere with the visual, perhaps below the x axis.

Code for the scalebar is: scalebar(dist = 50, dd2km = TRUE, model = "WGS84", st.size = 3, location="bottomleft", x.min=-71.70774, x.max=-70.63711, y.min=41.89158, y.max=42.7862)

image

oswaldosantos commented 5 years ago

Hi Paul, Sorry for the late reply. Did you try extending the bounding box southward?

PaulLantos commented 5 years ago

Thanks, I guess that's an option - but what I'd really prefer is to place it outside the map altogether, below the figure.

oswaldosantos commented 5 years ago

The scale bar dimensions are calculated using the coordinates of the bounding box and this is why it is always placed inside. With the blank() function you remove the background theme and get the map with the scale bar below.