David, Peter (and others),

If you're interested, I submitted this as a bug, and was informed of the
error of my ways by Professor Ripley
* His informative reply is copied below. *

The short answer is that panel.first is not a documented function of
"plot.formula", which is called by the generic "plot".

The solution gives me some insight into how the lazy evaluation works.

## Note: It's still not a documented use of the function!
 plot(y ~ x, data=dat, panel.first=quote(bgfun()))


On Wed, May 25, 2011 at 2:13 AM, <r-bugs@r-project.org> wrote:
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14591

Brian Ripley <ripley@stats.ox.ac.uk> changed:

          What    |Removed                     |Added
------------------------------
>
> ----------------------------------------------
>             Status|NEW                         |CLOSED
>         Resolution|                            |INVALID
>
> --- Comment #1 from Brian Ripley <ripley@stats.ox.ac.uk> 2011-05-25
> 03:13:34 EDT ---
> panel.first is not a documented argument to plot.formula: please do
> read the help.  It is a documented argument to plot.default(), as
>
> panel.first: an expression to be evaluated after the plot axes are set
>                ^^^^^^^^^^
> but you passed an evaluated function call.  It first ran bgfun() and then
> the
> plot call.  It worked for plot.default() by lazy evaluation.
>
> You needed
>
> plot(y ~ x, data=dat, panel.first=quote(bgfun()))

	[[alternative HTML version deleted]]

