В Thu, 4 Sep 2025 17:16:15 -0400 Steve Rowley via R-help <r-help@r-project.org> пишет:
> Then I use erase.screen() to erase the previous > image, use plot() to set up a plotting area, and display the image > with rasterImage(). erase.screen() works by drawing a background-coloured rectangle over the plot, so the previous images remain in the display list despite being completely over-painted: dev.new(bg='white') split.screen(c(1,2)) # [1] 1 2 recordPlot() |> object.size() # 57584 bytes for (i in 1:2) { screen(i, FALSE) plot(0:1, 0:1, type = 'n') rasterImage(as.raster(matrix(runif(2^20), 2^10)), 0, 0, 1, 1) } recordPlot() |> object.size() |> print(units = 'Mb') # 16.2 Mb for (i in 1:2) { erase.screen(i) screen(i, FALSE) plot(0:1, 0:1, type = 'n') rasterImage(as.raster(matrix(runif(2^20), 2^10)), 0, 0, 1, 1) } recordPlot() |> object.size() |> print(units = 'Mb') # 32.3 Mb How much slower would it be to maintain your own "display list" of images and redraw the plot from scratch (e.g. using layout()) every time you change it? -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide https://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.