[Rd] feature request: additional hook in plot.new()

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Sun Jan 23 20:06:09 CET 2011

Hi Tony,

On Sunday 23 January 2011, you wrote:
> Request: An additional hook in plot.new() that is called prior to the call
> to .Internal(plot.new()). Reason: To allow the hook to set up or modify a
> graphics device that the new plot will appear in.

for what it's worth, you can work around the lack of this hook by modifying 
plot.new(). Here's what we do in RKWard (in order to add a plot history 

"plot.new" <- function () 
	# [your code goes here]

	eval (body (.rk.plot.new.default))
formals (plot.new) <- formals (graphics::plot.new)
.rk.plot.new.default <- graphics::plot.new

# Note: This needs to be called *after* the package has been loaded
assignInNamespace ("plot.new", plot.new, envir=as.environment 

Note that at least persp() also sets up a new plot, _without_ calling 
plot.new(). So you'll want to catch that as well.

In RKWard we use this technique at a number of places to insert "hooks" where 
there are none, regularly.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20110123/bc417e9d/attachment.bin>

More information about the R-devel mailing list