R-alpha: '.Device' or equivalent missing -- possible solution
Martin Maechler (maechler@stat.math.ethz.ch)
Wed, 30 Oct 96 15:15:06 +0100
Date: Wed, 30 Oct 96 15:15:06 +0100
Message-Id: <9610301415.AA01006@>
From: Martin Maechler <maechler@stat.math.ethz.ch>
To: R-testers@stat.math.ethz.ch
Subject: R-alpha: '.Device' or equivalent missing -- possible solution
I have quite a few custom plot functions (in S-plus) which look like
abc <- function(.....) {
...
vcol <- if(.Device = 'postscript') 1 else seq(1:nc)
plot(......., col = vcol)
legend(......, col = vcol)
...
}
Unfortunately, there doesn't seem a generic way on how to get
the currently used graphics device...
One possible patch is to define
device := function(name, place, parameters) {
assign('.Device', name)
.Internal(device(name, place, parameters))
}
AND the three function x11, postscript, macintosh (any other?)
~~~ ~~~~~~~~~~ ~~~~~~~~~
call device(A,B,C) instead of .Internal(device(A,B,C))
------------- ------------------------
I've tested it, and it seems to work..
Then however, I'd propose to use 'postscript' instead of 'PostScript'
for obvious compatibility reasons...
Martin Maechler <maechler@stat.math.ethz.ch> <><
Seminar fuer Statistik, SOL F5
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1086
http://www.stat.math.ethz.ch/~maechler/
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe or unsubscribe
(in the "body", not the subject !) To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-