Skip to content

Commit 107b8eb

Browse files
authored
Support saving objects from grDevices::recordPlot()
Add support for saving plot objects created by the `recordPlot` function from the bundled `grDevices` package. The dedicated function `replayPlot` is used in a new `grid.draw` method to display a `recordedplot` in a device. This enables `ggsave` to be used more flexibly with base R code.
1 parent f7da3b4 commit 107b8eb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

R/save.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,10 @@ validate_device <- function(device, filename = NULL, dpi = 300, call = caller_en
329329
grid.draw.ggplot <- function(x, recording = TRUE) {
330330
print(x)
331331
}
332+
#' @export
333+
grid.draw.recordedplot <- function(x) {
334+
grDevices::replayPlot(x)
335+
}
332336

333337
absorb_grdevice_args <- function(f) {
334338
function(..., type, antialias) {

0 commit comments

Comments
 (0)