[![require(raster)
require(dismo)
oc_go<-gmap(extent(c(10042219 ,19646634,-7110934,1881964)),type='terrain')
plot(oc_go)
...添加另一个图层
legend("bottom", legend = c(" 1", " 2"," 3"," 4"," 5"," 6"," 7"," 8"), fill = colvec,
cex = 0.7, inset = 0.9,xpd=T,horiz = T)
结果是
我想把传说放在绘图区的底部或外面。
像这样使用par()
par(xpd = FALSE,mar=c(5.1, 4.1, 4.1, 4.5))
plot(oc_go)
par(xpd = TRUE)
legend(par()$usr[2] ,-1000000, legend = c(" 1", " 2"," 3"," 4"," 5"," 6"," 7"," 8"), fill = colvec,
cex = 0.7, inset = 0.9)
使用gmap()下载的地图似乎不能很好地工作。我还尝试覆盖情节区域,如答案3 Plot a legend outside of the plotting area in base graphics?
中所述