如何从 tmap 图例输出中删除逗号?

How can I drop the comma from a tmap legend output?

我有这个代码:

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)

输出这个legend。如何将 tmap 输入更改为仅包含没有逗号的单个年份?

这看起来是数字格式问题;您的代码不能完全重现,所以我不能 100% 确定,但从外观上我相当确定。

要补救,请尝试将其包含在您的 tm_layout 调用中:

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

顺便说一下,几个月前我写了一篇关于 tmap 图例格式的简短博客 post(我的问题是货币和百分号)。

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