在shapefile的图例中显示所有值

时间:2018-08-08 08:36:57

标签: r shapefile sp

样本数据:

library(raster)
fra <- getData("GADM", country = 'FRA', level = 1)
spplot(fra, "ID_1")

enter image description here

由于ID_1是整数,因此我想显示图例中的所有值,并用ID_1标记多边形。

1 个答案:

答案 0 :(得分:1)

spplot(fra, "ID_1", 
       colorkey = list(labels = list(at = fra@data$ID_1, labels = fra@data$NAME_1)))

enter image description here