user12657483
user12657483

Reputation: 17

How do I plot the coordinates of a spatial dataset when plotting it over a shapefile in R?

I am plotting a SpatialPointsDataFrame object of archaeological finds over a shapefile of the trench they were found in. So far I have managed to load and plot both sets of data together with:

coordinates(finds) <- ~x+y
trencharea <- readOGR(dsn="excpoly", layer="excpoly")
trencharea <- as.owin(trencharea)

plot(trencharea, main= "Trench & Finds")
plot(finds, add=TRUE, col = "blue", pch = 4)

However, I also want the x and y coordinates associated with the finds to be displayed on the x and y axes of my plot. How do I do this? I'm not looking for a solution that involves ggplot

Upvotes: 0

Views: 969

Answers (1)

UseR10085
UseR10085

Reputation: 8166

I don't know if I understood correctly, are you looking for the following

plot(trencharea, main= "Trench & Finds")
plot(finds, add=TRUE, col = "blue", pch = 4)
axis(1)
axis(2)
box(col = 'black')

Dummy plot enter image description here

Upvotes: 2

Related Questions