data structures - stack contour plot in R -
i have 2 different matrices (same x , y axis) plot contour plots contour (x,y,z). figure out how stack both matrix single plot in r.
i've been trying use as.layer function doesn't work
heteroplot <- contour(a[,1],t(a[,1]),nlevels=7,heterocov^2,col="green",xlab="ppm",ylab="ppm",bty="n") homocov <- contour(a[,1],t(a[,1]),nlevels=7,cova^2,col="red",xlab="ppm",ylab="ppm",bty="n") as.layer(homocov,x.same = true, y.same = true)
thanks!
you can this, if i've understood correctly, using add
argument contour()
. example:
x <- -6:16 y <- x z1 <- outer(x, sqrt(abs(x)), fun = "/") z2 <- outer(x, abs(x), fun = "/") contour(x, x, z1) contour(x, x, z2, add = true, col = "red") ## overlay second contour
which gives:
not sure as.layer
function comes from...?
Comments
Post a Comment