我试图在R中为入侵牡蛎物种(海洋)做物种分布图。使用我正在使用的代码,它将只在陆地上绘制点(ext= geographic.extent)。我找不到其他的“范围”选项,例如marine.extent或一种方法来执行-geographic.extent,以便它将成为除当前绘制区域之外的所有内容。
# Randomly sample points (same number as our observed points)
background <- randomPoints(mask = mask, # Provides resolution of sampling points
n = nrow(obs.data), # Number of random points
ext = geographic.extent, # Spatially restricts sampling
extf = 1.25) # Expands sampling a little bit
# Plot the base map
plot(wrld_simpl,
xlim = c(0, 30), #north and baltic sea
ylim = c(50, 70),
axes = TRUE,
col = "grey95",
main = "Presence and pseudo-absence points")
# Add the background points
points(background, col = "grey30", pch = 1, cex = 0.75)

发布于 2022-01-30 19:22:06
geographic.extent是您提供的一个变量。它可能是在您自己的代码中创建的,或者是由您加载的包创建的。你能编辑你的问题并显示它是什么(打印它)吗?
若要仅对某些区域的点进行示例,请使用掩码参数(正如您所做的)。在你的例子中,所有的陆地区域都应该是NA,所有的海洋区域都不应该是NA。
https://stackoverflow.com/questions/70915886
复制相似问题