https://github.com/cran/gstat
Raw File
Tip revision: 4cacf4bf71107e1bcf2ca721cc80b8522ce24161 authored by Edzer J. Pebesma on 20 February 2009, 00:00:00 UTC
version 0.9-60
Tip revision: 4cacf4b
hscat.R
hscat = function(formula, data, breaks, pch = 3, cex = .6, ...) {
	stopifnot(!missing(breaks))
	x = variogram(formula, data, cloud = TRUE, ...)
	.BigInt = attr(x, ".BigInt")
	x$left = x$np%%.BigInt + 1
	x$right = x$np%/%.BigInt + 1
	x$class = cut(x$dist, breaks = breaks)
	y = model.frame(formula, data)[[1]]
	x$xx = y[x$left]
	x$yy = y[x$right]
	lab = as.character(formula)[2]
	panel = function(x,y,subscripts, ...) {
		xr = c(min(x),max(x))
		llines(xr, xr)
		lpoints(x,y,...)
		ltext(min(x), max(y), paste("r =", signif(cor(x,y),3)), adj=c(0,0.5))
	}
	xyplot(xx~yy|class, x, panel = panel,
		main = "lagged scatterplots", xlab = lab, ylab = lab, ...)
}

back to top