[R] dev.copy2eps: Why did the colors come into my postscript output?

Paul E Johnson pauljohn at ku.edu
Thu Jun 5 22:04:44 CEST 2003


On a RedHat 7.3 system with R-1.6.1, I did this

 > x11(width=3.5,height=4,colortype="gray")

Then plotted (with matplot) a nice looking no-color graph on the screen, 
then I did this:

 > dev.copy2eps(file="test.eps",height=4,width=3.5)

I was surprised that the output in the eps file included the colored 
lines from the plot, even though the screen device was set to "gray" and 
on screen I did not see colors.

I put some of the eps files up here, so you can see what I mean:

http://lark.cc.ku.edu/~pauljohn/R/epsfiles

And if you don't have an eps viewer handy, I made png versions, since 
all browsers seem to show them.

http://lark.cc.ku.edu/~pauljohn/R/pngfiles/

The docs indicate that the x11 device is being copied, but I rather 
think that a plot object that exists "behind" the x11 device is being 
saved.?

I have since learned that I can put col=c("black") into the matplot 
command to make sure no colors are used, and that works the way I 
expect.  But I was curious about this behavior in dev.copy2eps.

-- 
Paul E. Johnson                       email: pauljohn at ku.edu
Dept. of Political Science            http://lark.cc.ku.edu/~pauljohn
1541 Lilac Lane, Rm 504
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66044-3177           FAX: (785) 864-5700




More information about the R-help mailing list