Skip to contents

Capture an unevaluated plotting expression for later display on the active graphics device. This is intended for base R graphics and other side-effect plotting workflows that do not naturally return a reusable plot object, such as plot(cars) or { model <- lm(dist ~ speed, data = cars); plot(model) }.

The expression is not evaluated when captured. Instead, print() re-runs it in the original calling environment when the plot is displayed through show_plot() or channel_plot().

Usage

capture_plot(expr)

Arguments

expr

A plotting expression to defer for later rendering.

Value

An object of class captured_plot.

Examples

captured <- capture_plot(plot(cars))