[R] 2 images on one plot
Petr PIKAL
petr.pikal at precheza.cz
Mon Mar 12 17:07:52 CET 2012
Dear all
with image I can plot only one set of values in one plot.
Do somebody have any insight how to put those 2 matrices into one picture
so that in one cell in image picture are both values from mat[1,1] and
mat2[1,1].
mat<-matrix(1:4, 2,2)
mat2<-matrix(4:1,2,2)
x <-1:2
y <-1:2
image(x, y, mat)
image(x, y, mat2)
The only way I found is to mix x or y for both matrices let say
xm <- sort(c(x,x+.5))
matm <- cbind(mat[,1], mat2[,1], mat[,2], mat2[,2])
image(xm,y,t(matm))
which lacks of elegance and is rather complicated when considering matrix
with more rows and columns.
Looking forward to any hint.
Regards
Petr
More information about the R-help
mailing list