Learn R Programming

playwith (version 0.8-56)

plotadd: Augment a plot in-line

Description

A simple way to encapsulate a plot and annotations in one call.

Usage

plotadd(FUN, ..., add.stuff = expression())

Arguments

FUN
a high-level plot function.
...
arguments to FUN.
add.stuff
expressions to augment the plot, evaluated after plotting.

Value

  • the value returned by the high-level plot function.

Details

This function is designed to be used by playwith, so that plots can be augmented while keeping the plot arguments in one call.

Examples

Run this code
if (interactive()) {

x <- rnorm(64)
plot(x, x^2, cex=2)
rug(x)
grid()

# do it all in one call with plotadd
plotadd(plot, x, x^2, cex=2, 
	add.stuff=expression(rug(x), grid()))

}

Run the code above in your browser using DataLab