is_low_change: Compare two recorded plots

Description Usage Arguments Value Examples

View source: R/plot.R

Description

Check if one plot only contains a low-level update of another plot.

Usage

1
is_low_change(p1, p2)

Arguments

p1, p2

Plot objects.

Value

Logical value indicating whether p2 is a low-level update of p1.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pdf(NULL)
dev.control("enable")  # enable plot recording
plot(1:10)
p1 = recordPlot()
abline(0, 1)  # add a line (a low-level change)
p2 = recordPlot()
plot(rnorm(100))
p3 = recordPlot()  # draw a completely new plot
dev.off()
knitr::is_low_change(p1, p2)  # true
knitr::is_low_change(p1, p3)  # false

knitr documentation built on April 24, 2021, 9:06 a.m.