If I use plot() to draw a GIS raster image, then use points() to add some points on the image: E.g. the following code
in_rast_str <- "PET_eclp.tif"
in_rast <- raster(in_rast_str)
selected_cells <- choose_points(in_rast_str,10,30)
plot(in_rast)
points(selected_cells[,1],selected_cells[,2])
The initial output renders correctly. However, if I then resize the plot either in the export window, or in the zoom window of RStudio, the points and the underlying raster shift relative to each other and become misaligned.
Is this a problem with RStudio or with R? I'm guessing that this could be a bug rather than that I am doing something obviously wrong.
Update...
Here are some examples:
and the same plot, but resized