() to 1st plot in layout() after calling 2nd
plot()?
Dear R users,
I create a graphic with two plots side by side using layout(), like
this:
layout(matrix(c(1,2),1))
plot(1:10,main=left plot)
lines(c(3:7,7:3),col=red)
plot(10:1,main=right plot)
The lines() obivously get added
801.408.8111
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of baptiste auguie
Sent: Sunday, October 04, 2009 3:33 AM
To: r-help
Subject: Re: [R] add lines() to 1st plot in layout() after calling 2nd
plot()?
Hi,
Try
-
project.org] On Behalf Of baptiste auguie
Sent: Sunday, October 04, 2009 3:33 AM
To: r-help
Subject: Re: [R] add lines() to 1st plot in layout() after calling 2nd
plot()?
Hi,
Try this,
dev.new()
layout(matrix(1:4,2, by=T))
plot(1:10,main=top left plot)
plot(1:10,main=top right plot
Thanks for the quick reply. However ...
David Winsemius dwinsem...@comcast.net 03-Oct-09 20:50:
MP layout(matrix(c(1,2),1))
MP plot(1:10,main=left plot)
MP plot(10:1,main=right plot)
MP lines(c(3:7,7:3),col=red)
MP
MP but of course now lines() gets added to the right plot. I
MP
MP Is there any
Hi,
Try this,
dev.new()
layout(matrix(1:4,2, by=T))
plot(1:10,main=top left plot)
plot(1:10,main=top right plot)
plot(1:10,main=bottom left plot)
plot(1:10,main=bottom right plot)
for (ii in 1:2){
for (jj in 1:2){
par(mfg=c(ii,jj))
text(5,2, lab=paste(plot #:,ii,,,jj,sep=))
}
}
par(mfg=c(1,1))
After some checking, I think the documentation is at best misleading
on this particular query. Nowhere could I find mention that par(mfg)
can work with layout. Instead, I found a warning that suggests
incompatibility (since mpg is explicitly tied to mfrow in ?par and
layout is said incompatible
baptiste auguie 04-Oct-09 10:32:
dev.new()
layout(matrix(1:4,2, by=T))
plot(1:10,main=top left plot)
plot(1:10,main=top right plot)
plot(1:10,main=bottom left plot)
plot(1:10,main=bottom right plot)
[...]
par(mfg=c(1,1))
lines(c(3:7,7:3),col=red)
Brilliant! Thanks!
baptiste auguie
Dear R users,
I create a graphic with two plots side by side using layout(), like this:
layout(matrix(c(1,2),1))
plot(1:10,main=left plot)
lines(c(3:7,7:3),col=red)
plot(10:1,main=right plot)
The lines() obivously get added to the left plot plot.
Now, I'm trying to write a function that builds
If you look at layout's help page there appears to be a worked example
of an even more complex task. The answer appears to be assingning
numbers to regions and then inserting par(mar= with an appropriately
constructed destination arguments prior to each added piece.
--
David
On Oct 3,
9 matches
Mail list logo