[R] par(mfrow,mai) and multiple plot problem

From: Robin Hankin <r.hankin_at_noc.soton.ac.uk>
Date: Mon 10 Jul 2006 - 19:09:52 EST


Hi

I'm having difficulty with a multiple plot. What I want is 12 plots, all of which are the same size and shape, differing only in colour. Each one is a square, so there is an asp=1 in the plot call. I'm working in an Sweave environment so I am free to choose the height and width of the plot.

I want the columns to be labelled at the head (here t=1,2,3) and the rows to be labelled at the left hand side (here an animal),

I don't want axes.

I want the plots to occupy the majority of the area of the output postscript.

I want the vertical distance between the plots to be the same as the horizontal distance between the plots (not critical but would be nice).

Can anyone help me with these requirements?

My best attempt is below, but it is no good because the ylab argument that I'm trying to use for the row labelling gets clipped. Also, I can't get my horizontal spacing to be equal to my vertical spacing (although the code below isn't _too_ bad).

f <- function(...){

   jj <- expand.grid(1:10,1:10)
   colnames(jj) <- c("","")
   par(mai=rep(0,4)+0.2)
   plot(jj,pch=16,asp=1, axes=FALSE, ...) }

postscript(file="~/f.ps",width=5,height=7)

par(mfrow=c(4,3))
f(main="t=1",ylab="fish")
f(main="t=2")
f(main="t=3")

f(ylab="dog")

f()
f()
f(ylab="slug")
f()
f()

f(ylab="pig")

f()
f()

dev.off()

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

______________________________________________
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 Mon Jul 10 19:13:21 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 10 Jul 2006 - 20:15:24 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.