2

I have this code:

tm_shape(usa, bbox = bbox, projection = map.crs)+
  tm_borders(col = "grey", lwd = 1) +
  tm_fill(palette = "grey") +
tm_grid(x = c(-77,-75,-73,-71),
      y = c(39,37,35),
      labels.inside.frame = F,
      labels.size = 1.1,
      col = "white") +
 tm_layout(outer.margins = c(.1,.03,.05,.05),
        outer.bg.color = "white")+
 tm_shape(sk.dat1,axes = T) +
 tm_dots("DATELAND", palette = colo,
      auto.palette.mapping=FALSE,
      size = .5,
      breaks = seq(2010,2017,
                   length.out =8),legend.show = T, alpha=.7) + 
 tm_layout(title = "Southern Kingfish Occurrence",
        legend.show = T,
        legend.position = c("right","bottom"),
        legend.bg.color = "grey70",
        legend.height = 2)

Which outputs this legend. How can I change the tmap input to only include single years with no commas?

dooogan
  • 67
  • 9

1 Answers1

7

This looks as a number format problem; your code is not exactly reproducible, so I can not make 100% sure, but I am fairly certain by the look.

To remedy try including this in your tm_layout call:

legend.format=list(fun=function(x) formatC(x, digits=0, format="d"))

By the way I wrote a short blog post on tmap legend formatting a couple months back (my problem were currency and percentage signs).

https://www.jla-data.net/eng/tmap-legend/

Jindra Lacko
  • 7,814
  • 3
  • 22
  • 44