How can I align the grid in the image with the data limits of a plot? My code places the grid in an undesirable fashion. I do not want to use abline as grid seems more professional.
plot(NA, xlim=c(0,1.0), ylim=c(0,1.0), xlab="X", ylab="Y", lwd=3)
grid(nx = 10, ny = 10, col = "lightgray", lty = "dotted", lwd = par("lwd"))