Re: [R] dev.print and X11(canvas = black)

2004-03-02 Thread Jeffrey J. Hallman
Prof Brian Ripley [EMAIL PROTECTED] wrote:

On Mon, 1 Mar 2004 [EMAIL PROTECTED] wrote:

   In Splus, I often use graphics windows with a black background and white
   foreground.  The S print.graph() function sends the current plot to my
   printer but with a white background and black foreground.  I'd like to

S (and S-PLUS) only has a few colour numbers, and you can change their 
interpretation on the screen graphics devices after plotting.  R does plot 
in colours rather than numbers.

   be able to do something similar in R, but can't figure out how.  I've
   tried various permutations of dev.copy() and dev.print(), but it seems
   that the foreground color is fixed when the original plot is drawn, and
   dev.copy always redraws it with that color.  So even though I can get my
   postscript output with a white background, things that were drawn white on the
   dark background of my X11 device are still drawn white when dev.copy'd
   to a postscript device.  Since the postscript has a white background,
   that means the white foreground stuff doesn't show up.
   
   Is there a way to handle this?  Or do I just have to give up on ever
   using a dark canvas in X11() if I ever want to print the result?

There are many ways to print the result, and re-running the plot commands 
after switching to a postscript() device is one of the best.  This would 
work for you if you only ever use colour numbers and switch the palette
(and par(fg)).

Jim Lemon made essentially the same suggestion: run the code that
created the plot twice, once with X11 as the active device, and again
with postscript as the active device.

The trouble with this is that is doesn't handle plots that the user has
edited.  I have some charts that users add things to interactively,
using combinations of locator(), text(), mtext(), and arrows().  There's
no nice way to know what a user has done to a plot before he attempts to
print it.

I know that R is internally maintaining a display list.  Is there a way
to access that without dropping into C?  And what's in it, anyway?

Jeff

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dev.print and X11(canvas = black)

2004-03-02 Thread Prof Brian Ripley
On Tue, 2 Mar 2004, Jeffrey J. Hallman wrote:

 Jim Lemon made essentially the same suggestion: run the code that
 created the plot twice, once with X11 as the active device, and again
 with postscript as the active device.
 
 The trouble with this is that is doesn't handle plots that the user has
 edited.  I have some charts that users add things to interactively,
 using combinations of locator(), text(), mtext(), and arrows().  There's
 no nice way to know what a user has done to a plot before he attempts to
 print it.

Yes, see the sections on `Graphics hardcopy' in section A.1 of MASS4 for 
exactly this comment: it is hardly news.

You could record what the users do as they do it by using your own 
versions of these functions.

 I know that R is internally maintaining a display list.  Is there a way
 to access that without dropping into C?  And what's in it, anyway?

Not really (recordPlot etc does), and not documented AFAIK (but Paul
Murrell will be able to correct me if I am wrong here).  However, I am
pretty sure that it has the actual plot colours and not the colour numbers
in it.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dev.print and X11(canvas = black)

2004-03-02 Thread Paul Murrell
Hi

Prof Brian Ripley wrote:
 On Tue, 2 Mar 2004, Jeffrey J. Hallman wrote:


Jim Lemon made essentially the same suggestion: run the code that
created the plot twice, once with X11 as the active device, and again
with postscript as the active device.

The trouble with this is that is doesn't handle plots that the user has
edited.  I have some charts that users add things to interactively,
using combinations of locator(), text(), mtext(), and arrows().  There's
no nice way to know what a user has done to a plot before he attempts to
print it.


 Yes, see the sections on `Graphics hardcopy' in section A.1 of MASS4 for
 exactly this comment: it is hardly news.

 You could record what the users do as they do it by using your own
 versions of these functions.


I know that R is internally maintaining a display list.  Is there a way
to access that without dropping into C?  And what's in it, anyway?


 Not really (recordPlot etc does), and not documented AFAIK (but Paul
 Murrell will be able to correct me if I am wrong here).  However, I am
 pretty sure that it has the actual plot colours and not the colour 
numbers
 in it.

Just to confirm, the current internal display list should be considered 
a black box;  the only user-level access to it is record/replayPlot() 
and dev.copy/print/control().

Paul

p.s. If you really want to know what's in the display list, you should 
start reading at GEcreateSnapshot in R/src/main/engine.c
--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] dev.print and X11(canvas = black)

2004-03-01 Thread jhallman
In Splus, I often use graphics windows with a black background and white
foreground.  The S print.graph() function sends the current plot to my
printer but with a white background and black foreground.  I'd like to
be able to do something similar in R, but can't figure out how.  I've
tried various permutations of dev.copy() and dev.print(), but it seems
that the foreground color is fixed when the original plot is drawn, and
dev.copy always redraws it with that color.  So even though I can get my
postscript output with a white background, things that were drawn white on the
dark background of my X11 device are still drawn white when dev.copy'd
to a postscript device.  Since the postscript has a white background,
that means the white foreground stuff doesn't show up.

Is there a way to handle this?  Or do I just have to give up on ever
using a dark canvas in X11() if I ever want to print the result?

Please reply directly.

Jeff

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] dev.print and X11(canvas = black)

2004-03-01 Thread Prof Brian Ripley
On Mon, 1 Mar 2004 [EMAIL PROTECTED] wrote:

 In Splus, I often use graphics windows with a black background and white
 foreground.  The S print.graph() function sends the current plot to my
 printer but with a white background and black foreground.  I'd like to

S (and S-PLUS) only has a few colour numbers, and you can change their 
interpretation on the screen graphics devices after plotting.  R does plot 
in colours rather than numbers.

 be able to do something similar in R, but can't figure out how.  I've
 tried various permutations of dev.copy() and dev.print(), but it seems
 that the foreground color is fixed when the original plot is drawn, and
 dev.copy always redraws it with that color.  So even though I can get my
 postscript output with a white background, things that were drawn white on the
 dark background of my X11 device are still drawn white when dev.copy'd
 to a postscript device.  Since the postscript has a white background,
 that means the white foreground stuff doesn't show up.
 
 Is there a way to handle this?  Or do I just have to give up on ever
 using a dark canvas in X11() if I ever want to print the result?

There are many ways to print the result, and re-running the plot commands 
after switching to a postscript() device is one of the best.  This would 
work for you if you only ever use colour numbers and switch the palette
(and par(fg)).

 Please reply directly.
 
 Jeff

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html