I have plotted an overlay map of hillshade and landslide susceptibilities. I would like to zoom in on a particular area of the plot.
landslide_raster_pred <-predict(ta,landslide_model, type = "response")
hillshade <- hillShade(slope_data, aspect_ratio, angle=45, 0)
overlay_map <- overlay(landslide_raster_pred,hillshade, fun=function(x,y){return(x*y)})
dev_coordinate=data.frame(x=714717.7, y=9560497)
# Extract the susceptibility at the point of interest from the raster
dev_prediction <- extract(landslide_raster_pred, dev_coordinate)
# Plot the overlay map with the point of interest
plot(overlay_map, main = "Landslide susceptibility and hillshade map",
xlab = "longitude",
ylab ="latitude")
points(c(714717.7), c(9560497))
How can i zoom in on the area where the point is to show a better picture/resolution? Any help will be appreciated thank you.
Example data
library(raster)
f <- system.file("external/test.grd", package="raster")
r <- raster(f)
pt <- cbind(180000,331000)
plot(r); points(pt)
You can create an extent like this
s <- 500
e <- extent(pt[1]-s, pt[1]+s, pt[2]-s, pt[2]+s)
And then use that to plot like this
plot(r, ext=e)
Or like this
zoom(r, e)
You can also do this interactively, by drawing a rectangle on the plot
plot(r)
zoom(r, drawExtent())
Or
plot(r, xlim=c(pt[1]-s, pt[1]+s), ylim=c(pt[2]-s, pt[2]+s))