我想删除区域外的小段(data = station_EVHOE)。 the map here我绘制的线段坐标
为此,我画了一个黑色的线段,划定了相关的区域(这是右边的区域)。 所以我想删除左侧区域的点。
我的代码与ggplot制作:
d <- ggplot() +
coord_map(xlim = c(-12,-1), ylim = c(43,52)) +
geom_polygon(aes(x=longitude, y=latitude), data = coast_EVHOE) +
geom_segment(aes(x = longitude_début, y = latitude_début, xend = longitude_fin, yend = latitude_fin, colour = as.factor(annee)), data = station_EVHOE) +
geom_segment(aes(x = -4.374794, y = 47.7975, xend = -7.8694, yend = 43.773630))
那么,是不是可以提取黑色分割的坐标,为了改掉正确的区域外点?
当然可以,但你必须这样做GGPLOT2之外。请参阅'rgeos'和'sp :: over'。例如。 http://stackoverflow.com/questions/19002744/spover-for-point-in-polygon-analysis –