0
votes

I would like to replay several recorded plot in one unique plot that contain all plots. This is an example of recorded plot that I created previously.

plot(1:10, main = "plot1")

PLOT1<-recordPlot()

plot(10:1, main = "plot2")

PLOT2<-recordPlot()

plot(rnorm(10), main = "plot3")

PLOT3<-recordPlot()

Then I tried to use

opar <- par()

par(mfcol = c(1, 3))

replayPlot(PLOT1)

replayPlot(PLOT2)

replayPlot(PLOT3)

But in these way I can only see one graph at the time and I want the three together.

1

1 Answers

0
votes

As work-around set par(mfcol= c(1,3)) before recording as plot creates just image not object will do the trick. Actually, if mfcol is set as c(1,3) then PLOT1 will record 'plot1' but PLOT2 will record both 'plot1' & 'plot2' and 'PLOT3` will record all 'plot1', 'plot2' & 'plot3'. Hence, replaying those saved plots will give impression as they are shown in order.

This should work.

par(mfcol= c(1,3))

plot(1:10, main = "plot1")

PLOT1 <- recordPlot()

plot(10:1, main = "plot2")

PLOT2 <- recordPlot()


plot(rnorm(10), main = "plot3")

PLOT3<-recordPlot()


replayPlot(PLOT1)

replayPlot(PLOT2)

replayPlot(PLOT3)