Re: [R] call function immediately before plot.new()

From: Jake Michaelson <jake.michaelson_at_gmail.com>
Date: Mon, 28 Apr 2008 16:30:40 +0200

Thanks Matthias and Gabor. You're both right. Matthias, I think that *was* what I read although now I realize that Gabor's suggestion is more along the lines of what I want to do. Though I have found one situation where this wouldn't really work properly:

par(mfrow=c(2,2))

plot(rnorm(10))
plot(rnorm(10))
plot(rnorm(10))

plot.new()

Now my goal is actually to *only* call this custom function before the entire device is cleared for a new plot or set of plots. Since the above example plots multiple times in the same window, the function would be called each time, when really I just want it called once, right before the device window is cleared for another plot.

Is there a way to do this or is this asking too much of R?

Thanks,

Jake

On Mon, Apr 28, 2008 at 3:41 PM, Gabor Grothendieck <ggrothendieck_at_gmail.com> wrote:

> See:
>
> ?frame
>
> e.g.
>
> setHook("plot.new", function(...) cat("Starting plot\n"))
>
>
> On Mon, Apr 28, 2008 at 9:22 AM, Jake Michaelson
> <jake.michaelson_at_gmail.com> wrote:
> > Hi all,
> >
> > I would like to be able to call a custom function automatically before
> > plot.new() is called (more specifically, before a new plot is created on
> the
> > current graphics device). Recently I've been poking around in the help
> > files of some of the low(er) level plotting functions, and I seem to
> > remember something saying that you could somehow add a setting to call a
> > function immediately before plot.new() is called (something kind of in
> the
> > spirit of .First). I've been looking everywhere, and I can't find the
> > documentation I'm thinking of, which makes me wonder if I'm just making
> all
> > this up.
> >
> > Can this be done?
> >
> > Thanks,
> >
> > Jake
> >
> > [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help_at_r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 28 Apr 2008 - 14:35:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 28 Apr 2008 - 16:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive