0

我正在尝试在 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)

陆地而非海洋区域上的所有标绘点

4

1 回答 1

0

geographic.extent是您提供的变量。它可能是在您自己的代码中创建的,或者由您加载的包创建。你能编辑你的问题并显示它是什么(打印它)吗?

要仅从某些区域采样点,请使用 mask 参数(就像您所做的那样)。在您的情况下,所有陆地区域都应该是NA,所有海洋区域都不应该是NA

于 2022-01-30T19:22:06.610 回答