[R] Multiple plots of multiple plots

showa mreback at gmail.com
Thu Oct 8 18:27:44 CEST 2009


I'd like to generate on a single device multiple plots, each of which
contains two plots. Essentially, I've got sub-plots which consist of two
tracks, the upper one displaying gene expression data, and the lower one
showing gene position along the chromosome. I'd like to display four of
these sub-plots (i.e. genes) on one device, but I can't seem to invoke the
par(mfrow=...) or layout(matrix(...)) functions on my sub-plots.

I've got something like:

expression<-function(gene){
par(fig=c(0,1,0.3,1))
plot(...)}

position<-function(gene){
par(fig=c(0,1,0,0.4),new=TRUE)
plot(...)}

plot.gene<-function(gene){
expression(gene)
position(gene)}

plot.multigene<-function(gene,...){
pdf(paste(gene,".pdf",sep=""))
par(mfrow=c(2,2))
tapply(gene,gene, plot.gene)
dev.off()}

The par(mfrow=) in plot.multigene, even when 'new=TRUE', is disregarded and
I just get one sub-plot per page. Suggestions?
-- 
View this message in context: http://www.nabble.com/Multiple-plots-of-multiple-plots-tp25803288p25803288.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list