On 07/29/2010 07:02 AM, Dennis Fisher wrote:
Colleagues
I do a series of calculations, then add some output as a line in a graphic.
This is repeated a large number of times. Then, I move to the next panel and
do a similar set of calculations, add lines, ....
Many of the calculations are identical for the two panels, so the calculations
are done twice. In order to avoid this redundancy, it would be ideal to do the
following:
1. Set up the two panels (i.e., draw the axes for each
2. Do the calculations for the first iteration for both panels. Draw
the line in each panel. Then move to the second iteration.
In other words, I am trying to add to both two panels in an alternating manner
-- do some calculations, add a line to panel 1, then add a line to panel 2,
then do more calculations.
Hi Dennis,
You are probably looking for split.screen. You can specify the layout:
split.screen(c(1,2))
make a plot on each screen:
plot(1:5)
screen(2)
plot(5:1)
swap back and forth to add lines
screen(1,FALSE)
lines(c(2,5,4,3,1))
screen(2,FALSE)
lines(c(1,2,5,2,3))
and so on.
Jim
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.