[R] problem plotting in a grid
Jonathan
jonsleepy at gmail.com
Mon Jul 30 06:53:29 CEST 2012
Hi all,
I'm trying to generate a grid of four plots. The first 2 appear
just fine, but the final 2 will not appear in the grid, instead
overwriting the first two. Any ideas on how to get them all in the
same window would be greatly appreciated.
Cheers,
Jonathan
library(fields)
par(mfrow=c(2,2)) #2x2 plot windows
plot(c(2,4),c(2,2)) # works fine
plot(c(2,4),c(2,2)) # works fine
x <- 1:4
y <- 5:10
z <- matrix(0,length(x),length(y))
z2 <- matrix(0,length(x),length(y))
for(i in 1:length(x))
{
for (j in 1:length(y))
{
z[i,j] <- sample(4:10,1)
z2[i,j] <- sample(4:10,1)
}
}
filled.contour(x,y,z,color.palette=topo.colors) # doesn't work
image.plot(x,y,z2,add=TRUE) # doesn't work
More information about the R-help
mailing list