Skip to content
Prev 156605 / 398506 Next

Plot availability

On Fri, Sep 19, 2008 at 2:00 PM, john crepezzi <seejohnrun at gmail.com> wrote:
Using classic graphics try this:

# classic graphics
plot(BOD)
p <- recordPlot()

# some times go by and other plots are made
plot(0)

# now go back to the original plot and add more
replayPlot(p)
points(5, 15, col = "red")


In lattice graphics its like this:

# lattice graphics
library(lattice)
p <- xyplot(demand ~ Time, BOD)

# some times go by and other plots are made
plot(0)

# now replot the original plot and add more
plot(p)
trellis.focus("panel", 1, 1)
panel.points(5, 15, col = "red")
trellis.unfocus()

ggplot2 is also grid-based and should be amenable to
this sort of thing too.