| recordedtinyplot | R Documentation |
Objects of class recordedtinyplot are returned by
tinyplot(..., record = TRUE). They are a thin wrapper around
recordPlot—thus conferring the same replay
functionality—but with the initializing plot call and state added, so that
recorded (tiny)plots play nicely with tinyplot_add() and
friends.
## S3 method for class 'recordedtinyplot'
print(x, ...)
## S3 method for class 'recordedtinyplot'
str(object, ...)
x |
a |
... |
further arguments passed to |
object |
a |
Recording requires a device whose display list is enabled (see
dev.control); without one there is nothing to
record and the returned plot will replay blank. Interactive devices—the
plot pane of an IDE, say—typically enable it by default, whereas
file-based devices (png, pdf, svg, ...) do not. tinyplot() enables
it for any device that it opens itself via the file argument, and warns
if the current device is not recording.
Printing a recorded plot—either explicitly with print(), or simply by
evaluating it at the console—is what restores the initializing call, so
that a subsequent tinyplot_add() layers onto it. Calling
replayPlot() on the object instead redraws it
just as it would any other recording, but leaves the current plot context
untouched; layering after that route targets whichever plot was drawn last.
This class is experimental, as is the record argument that produces it.
print() replays the plot and returns x invisibly.
recordPlot and
replayPlot, which this class wraps and defers to
for the actual recording and replaying.
dev.control for enabling a device's display list,
without which there is nothing to record.
## Not run:
p = tinyplot(Sepal.Length ~ Petal.Length | Species, data = iris,
record = TRUE)
tinyplot(1:10) # some other plot
p # replay, restoring plot context
tinyplot_add(type = "lm") # layers onto p, not onto the 1:10 plot
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.