Hi I have the next code:
par(mfrow=c(1,3))
plot(BCxyz[,1], BCxyz[,2], main=\"Bray-Curtis 1:2\", pch=20, cex = 3, col=c(\"blue\", \"green\", \"red\", \"yellow\")
You can use recordPlot
to save the current plot and recall it later.
par(mfrow=c(1,3))
plot(1) ; plot(2); plot(3)
figure1 <- recordPlot()
# view then close the plot window, just to prove that redrawing it works
figure1 # redraws it when interactive on the console
replayPlot(figure1) # same thing
print(figure1) # indirect, calls replayPlot
The last two commands have the same result on the console, but if you are going to "replay" the plot programmatically (e.g., within {...}
code-blocks or functions), you should use the replayPlot
function directly. The reason just figure1
works by itself on the console (no print
or replayPlot
) is that figure1
is of class "recordedplot"
, and the base-R grDevices:::print.recordedplot
S3 method calls replayPlot
directly.