-1
我设法建立一个地图,甚至包括指北针,但不能得到map.scale
工作,让这种类型的错误:错误添加比例尺与map.scale
Error in map.scale(x = -83, y = 12, ratio = FALSE, relwidth = 0.2, cex = 0.6) : unused arguments (ratio = FALSE, relwidth = 0.2, cex = 0.6)
这里是代码:
library(maps)
library(mapdata)
library(ggmap)
library(mapproj)
library(maptools) #for shapefiles
library(scales) #for transparency
library(GISTools)
range <- readShapePoly("isthmanianpacificmoistforestecoregion") #layer of data for species range
map("worldHires", c('Cost', 'pan', 'Nic', 'Colombia'), xlim=c(-89,-75),ylim=c(5,13), col="lightgray", fill=TRUE) #plot the region I want
map.scale(-81,8,relwidth = 0.15, metric = TRUE, ratio = TRUE)
plot(range, add=TRUE, xlim=c(-89,-75),ylim=c(5,13), col=alpha("green", 0.6), border=TRUE)
map.scale(x=-80, y=10) #, relwidth=0.3, cex=0.5, ratio=FALSE)
north.arrow(xb=-77, yb=12, len=0.2, lab="N", col="black", fill=TRUE) #