I tried to plot two semivariogram in one plot but unfortunately it does not work. I guess the solution is pretty easy but I am at the end of my latin.
This ist the code of the variograms I want to put in one plot together:
variog_iso_a1 <- fit.variogram( emp_variog_iso_a1,
vgm( psill = 2000,
model = "Sph",
range = 200,
nugget = 500))
plot(emp_variog_iso_a1, variog_iso_a1, as.table=TRUE, main = "Acker H1 C_org", plot.numbers=T)
variog_iso_a2 <- fit.variogram( emp_variog_iso_a2,
vgm( psill = 2000,
model = "Sph",
range = 200,
nugget = 500))
plot(emp_variog_iso_a2, variog_iso_a2, as.table=TRUE, main = "Acker H2 C_org", plot.numbers=T)
Secondly I would also like to plot two semivariogram in one plot but with a second y-axis on the right side because of the different values.
variog_iso_a1 <- fit.variogram( emp_variog_iso_a1,
vgm( psill = 2000,
model = "Sph",
range = 200,
nugget = 500))
plot(emp_variog_iso_a1, variog_iso_a1, as.table=TRUE, main = "Acker H1 C_org", plot.numbers=T)
variog_iso_l1 <- fit.variogram( emp_variog_iso_l1,
vgm( psill = 2000,
model = "Sph",
range = 200,
nugget = 500))
plot(emp_variog_iso_l1, variog_iso_l1, as.table=TRUE, main = "Acker H1 Lichtwert", plot.numbers=T)
I was only able two show the points of each variogram but not with the model fitted inside. This is the code I tried but does not work!
plot(emp_variog_iso_a1$dist, emp_variog_iso_a1$gamma, ylim=c(0,2500))
points(emp_variog_iso_a2$dist, emp_variog_iso_a2$gamma, col = "red", add=T, labels=emp_variog_iso_a2$np)
plot(emp_variog_iso_a1$dist, emp_variog_iso_a1$gamma, ylim=c(0,2500),main="Semivarianz Lichtwert und organische Substanz Horizont 1 Ackerland", ylab = "Semivarianz", xlab = "Distanz" )
par(new = TRUE)
plot(emp_variog_iso_l1$dist, emp_variog_iso_l1$gamma, col = "red", labels=emp_variog_iso_l1$np )
points(emp_variog_iso_l1$dist, emp_variog_iso_l1$gamma, col = "red", add=T, labels=emp_variog_iso_l1$np, yaxt = "n")
plot(emp_variog_iso_a2$dist, emp_variog_iso_a2$gamma, ylim=c(0,2500),main="Semivarianz Lichtwert und organische Substanz Horizont 2 Ackerland", ylab = "Semivarianz", xlab = "Distanz" )
points(emp_variog_iso_l2$dist, emp_variog_iso_l2$gamma, col = "red", add=T, labels=emp_variog_iso_l2$np)
Thanks for any help!!!
You can use
variogramLine()
for this:next, add it to your plot with
lines()