我有要绘制的SpatialPolygons或SpatialPolygonsDataFrames。如何使用R中的三种绘图系统(基本图形,点阵图形和ggplot2)更改颜色?
示例数据:
library(sp)
Srs1 = Polygons(list(Polygon(cbind(c(2,4,4,1,2),c(2,3,5,4,2)))), "s1")
Srs2 = Polygons(list(Polygon(cbind(c(5,4,2,5),c(2,3,2,2)))), "s2")
SpDF <- SpatialPolygonsDataFrame( SpatialPolygons(list(Srs1,Srs2)),
data.frame( z=1:2, row.names=c("s1","s2") ) )
spplot(SpDF, zcol="z")
spplot
,请使用par.settings = list(panel.background=list(col="lightblue"))
。