Skip to content

Commit faf6159

Browse files
committed
Register print_plot() methods
1 parent 53dab9d commit faf6159

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NAMESPACE

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method(print_plot,"function")
4+
S3method(print_plot,default)
5+
S3method(print_plot,ggplot)
6+
S3method(print_plot,recordedplot)
37
export(expect_doppelganger)
48
export(write_svg)
59
import(rlang)

R/svg.R

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@ print_plot <- function(p, title = "") {
2727
UseMethod("print_plot")
2828
}
2929

30+
#' @export
3031
print_plot.default <- function(p, title = "") {
3132
print(p)
3233
}
3334

35+
#' @export
3436
print_plot.ggplot <- function(p, title = "") {
3537
if (title != "" && !"title" %in% names(p$labels)) {
3638
p <- p + ggplot2::ggtitle(title)
@@ -41,10 +43,12 @@ print_plot.ggplot <- function(p, title = "") {
4143
print(p)
4244
}
4345

46+
#' @export
4447
print_plot.recordedplot <- function(p, title) {
4548
grDevices::replayPlot(p)
4649
}
4750

51+
#' @export
4852
print_plot.function <- function(p, title) {
4953
p()
5054
}

0 commit comments

Comments
 (0)