[R] Plotting rows (or columns) from a matrix in different graphs, not using "par"

From: Camarda, Carlo Giovanni <Camarda_at_demogr.mpg.de>
Date: Wed 15 Jun 2005 - 04:00:32 EST


Dear R-users,
I would like to ask whether it's possible (for sure it would be), to plot each rows (or columns) in different graphs and in the same figure region without using the function "par" and then struggling around with
"axes" and labels etc.

Luckily, I would always have "rows + columns = even number" and the same
"ylim".

The next one could be a sort of example on what I would like to avoid plotting the rows of the matrix "mat":

########### EXAMPLE ######################
dat <- sort(runif(16, 1, 1000))

mat <- matrix(dat, ncol=4, byrow = T)
y <- seq(1950, 1953)
par(mfrow=c(2,2))
plot(y, mat[1,], ylim=c(1,1000), axes=F, xlab="", ylab="simul.") box()
axis(side=2, tick=T, labels=T)
axis(side=3, tick=T, labels=T)
plot(y, mat[2,], ylim=c(1,1000), axes=F, xlab="", ylab="")
box()
axis(side=3, tick=T, labels=T)

plot(y, mat[3,], ylim=c(1,1000), axes=F, xlab="years", ylab="simul.") box()
axis(side=1, tick=T, labels=T)
axis(side=2, tick=T, labels=T)
plot(y, mat[4,], ylim=c(1,1000), axes=F, xlab="years", ylab="")
box()
axis(side=1, tick=T, labels=T)
########### END EXAMPLE ########################

Naturally something more compact would be even nicer.

Thanks in advance,
Carlo Giovanni Camarda

+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Jun 15 04:50:42 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:32:36 EST