I have latitude and longitude point data over time. I would like to plot (in R or Matlab) a contour map of spatial-temporal K function (much like the one below), but have no ide
Here's an outline of how you might start this in R. Note that this does not address the question of 'how to compute a spatial-temporal K function'.
First, get example data from plot raster with discrete colors using rasterVis
x=seq(-107,-106,.1)
y=seq(33,34,.1)
coords=expand.grid(x,y)
data1=data.frame(coords,depth=runif(nrow(coords),0,2))
names(data1)=c('x','y','value')
# get max and min values
xmn=min(data1[,1]); xmx=max(data1[,1])
ymn=min(data1[,2]); ymx=max(data1[,2])
Now compute an interpolated raster from the raw data...
# compute interpolated raster. Note that this is not the 'spatial-temporal K function' requested in the question, as pointed out in a comment below, but a linear interpolation
library(akima)
akima.li <- interp(data1[,1], data1[,2], data1[,3], duplicate = "median",
xo=seq(xmn,xmx, length=100),
yo=seq(ymn,ymx, length=100))
Plot the raster...
# plot interpolated raster
image(akima.li, col = rainbow(100, alpha = 1))

Plot the raster as a contour plot...
# plot interpolated contour
contour(akima.li, nlevels = 3)

Now put the raster and contour together and this is close to the example image you posted...
# put the raster and contours together
image(akima.li, col = rainbow(100, alpha = 1))
contour(akima.li, nlevels = 3, add = TRUE)

And with a few minor tweaks, here is a very close match to the style of the example...
image(akima.li, col = gray.colors(10, start = 0, end = 0.9, gamma = 2.2, alpha = 1))
contour(akima.li, nlevels = 3, add = TRUE)

Finally, this is pretty much a match, with grey-scale contour fill, contour labels but no contour lines
image(akima.li, col = gray.colors(10, start = 0, end = 1, gamma = 1, alpha = 1))
contour(akima.li, nlevels = 3, add = TRUE, lty = 0)
