R/plvar.R

Defines functions plvar

Documented in plvar

plvar <-
function(vagram, n = 4, fit = T, type = "p")
{
	if(fit) {
		vagr1 <- vagram$dist[vagram$dist < vagram$rang1 * n]
		# n x range
		zva <- vagram$vario[1:length(vagr1)]
		plot(vagr1, zva, xlim = c(0, max(vagr1)), ylim = c(0, max(
			zva) * 1.05), xlab = "Distance", ylab = "Variogram",
			title = " ", type = type)
		lines(c(0, vagr1[1]/2, vagr1), spherical(vagram$rang1, vagram$
			sill, vagram$nugget, c(0, vagr1[1]/2, vagr1)))
		tloc <- c(max(vagr1) * 0.9, max(zva) * 1.04)
		tloc <- matrix(tloc, 2, 2, byrow = T)
		tloc[2, 2] <- max(zva) * 1.01
		tmp <- vagram$nugget/vagram$sill
		tmp <- round(tmp, digits = 2)
		tmp <- as.character(tmp)
		tmp <- substring(tmp, 1, 4)
		txt <- c(paste("nugget/sill=", tmp), paste("range = ", 
			as.character(round(vagram$rang1, digits = 2))))
		print(txt)
		text(tloc, txt)
	}
	else {
		plot(c(0, vagram$dist), c(0, vagram$vario), ylim = c(0, max(
			vagram$vario)), xlab = "Distance", ylab = "Variogram",
			title = " ")
	}
}

Try the geo package in your browser

Any scripts or data that you put into this service are public.

geo documentation built on May 2, 2019, 5:22 p.m.