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]]
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. >
Hi Jake, are you looking for argument "panel.first" of "plot.default"? ?plot.default panel.first: an expression to be evaluated after the plot axes are set up but before any plotting takes place. This can be useful for drawing background grids or scatterplot smooths. hth, Matthias Jake Michaelson 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. >-- Dr. Matthias Kohl www.stamats.de