Skip to content

Zoo panel function

2 messages · Gabor Grothendieck

#
On Wed, Aug 1, 2012 at 12:40 AM, Gene Leynes <gleynes at gmail.com> wrote:
As documented in ?plot.zoo the ... argument consists of graphical
parameters so its not just passed to the panel function -- you can
expect warnings if, as here, the parameters are not graphical (as they
are passed to other functions and not just the panel function).

What you can do is to create a panel constructor that uses lexical
scoping to encapsulate the additional parameters:

make.mypanel <- function(v) function(...) mypanel(..., v)
plot(zobj, panel = make.mypanel(v=0) )

Here make.mypanel constructs a mypanel function with the v argument
filled in so you don't have to separately pass it via ... .
#
On Wed, Aug 1, 2012 at 7:31 AM, Gabor Grothendieck
<ggrothendieck at gmail.com> wrote:
One further idea that will save you from defining a constructor
function is to use Curry from the functional package like this:

library(functional)
plot(zobj, panel = Curry(mypanel, v=0) )

Here Curry returns mypanel but with v filled in already.