1

我有这个代码:

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)

哪个输出这个图例。如何将 tmap 输入更改为仅包含不带逗号的单年?

4

1 回答 1

6

这看起来是一个数字格式问题;您的代码并非完全可重现,因此我无法 100% 确定,但从外观上我可以确定。

要补救,请尝试在您的tm_layout通话中包含此内容:

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

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

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

于 2018-02-01T08:49:39.857 回答