ggspatial
ggspatial copied to clipboard
annotation_scale specified in map units
Would it be possible to have a parameter similar to tmap's tm_scale_bar(breaks=c(0, 100), ...) to tell annotation_scale() to draw only one section instead of the black-white pattern?
A nice side effect could be to provide control over the size for the scale bar in map units. Although, that is probably a separate feature wish.
I think you can do bar_cols = "black"! Is this what you mean:
library(ggplot2)
library(ggspatial)
load_longlake_data()
ggplot() +
layer_spatial(longlake_depthdf) +
annotation_scale(bar_cols = "black")

Created on 2019-07-01 by the reprex package (v0.2.1)
The control over the exact width of the scalebar in map units is indeed a separate feature...I think there are other packages that allow this. I have it parameterized aswidth_hint, which is a number between 0 and 1 that is the suggested proportion of the plot width.
I ended up with bar_cols='gray30', line_col='gray30' which looks okay. Saving the map to pdf, this will still be 5 rectangles. Compared to the amount of vertices in the rest of the map this wont matter that much datawise.
yep, in tmap, for instance, one can specify the exact width of the scale bar in map units. But I couldn't find a way in tmap to put the text ('100 m') right or left of the bar.
I need to do 25 map all having a similar but not exactly the same scale All shall have a scale bar of the same length in map units to make the small differences in scale obvious. So, in my humble opinion specifying the size of the scale bar in map units would be a great addition to ggspatial.
I think that the scalebar code should be rewritten to use better breaks functions as well...this issue is a good reminder that the scalebar code needs a bit of work.