Hi, I would like to 'color code' all the locations I have (latitude and longitude) based on the dividing line on my map. That would mean, that all locations to the left of that line are yellow, and all the locations to the right of that line are green.
I have not been able to find a solution in r of how to do this. Any help? I have attached my code below to make the plot. To describe my data, it is a series of lon and lat coordinates, and the 'line' is the same.
aleu<- getNOAA.bathy(lon1 = -100, lon2 = -20, lat1 = 10, lat2 = 60, resolution = 3, keep = TRUE) plot(aleu, image = TRUE, land = TRUE, axes = FALSE, lwd=0.1, bpal = list(c(0, max(aleu), grey(.7), grey(.9), grey(.95)), c(min(aleu), 0, "darkblue", "lightblue"))) plot(aleu, n = 1, lwd = 0.5, add = TRUE) # Add latitude and longitude grid lines axis(1, at = seq(-100, -20, by = 10), labels = TRUE, pos = 10) # Longitude (bottom) axis(2, at = seq(20, 60, by = 10), labels = TRUE, pos = -100) # Latitude (left) points(subset_dataanim$lon,subset_dataanim$lat,pch = 16, cex = 0.25) lines(pathway$Longitude, pathway$Latitude, col = "red", lwd = 2)