[R] Solid and dotted lines saving an xyplot

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Oct 18 20:55:48 CEST 2005


You are not `saving' an xyplot, but re-plotting on a different device.

Different trellis devices have different default settings: you did not 
mention that the backgound had changed from grey to white (but it has).

Try trellis.device(color=FALSE) to get on screen what you see on paper, or 
use trellis.par.set() (of superpose.line$lty, I believe) to control just 
this single aspect of the plot.

On Tue, 18 Oct 2005, Camarda, Carlo Giovanni wrote:

> Dear R-users,
> I would a small problem saving a graph with postscript after using
> xyplot.
> Whereas in the R-screen the two lines are solid, once the image is saved
> as .eps file the second lines (blue in the following example) is dotted.
> Here there is a simple example.
> Thanks in advance for your help,
> Carlo Giovanni Camarda
>
> # creating data
> a1 <- sort(runif(10))
> a2 <- sort(runif(10))
> a3 <- sort(runif(10))
> a4 <- sort(runif(10))
> a <- c(a1,a2,a3,a4)
> b1 <- sort(runif(10))
> b2 <- sort(runif(10))
> b3 <- sort(runif(10))
> b4 <- sort(runif(10))
> b <- c(b1,b2,b3,b4)
> c <- rep(1:10,4)
> d <- rep(1:4, each=10)
> # creating a dataset
> df <- data.frame("a"=a,"b"=b,"c"=c,"d"=d)
> # plotting in R (look the solid lines)
> xyplot(a + b ~ c | d, data = df, col=c("red", "blue"), type="l",
> layout=c(2,2))
> # saving somewhere (one solid and one dotted line)
> postscript("example.eps")
> xyplot(a + b ~ c | d, data = df, col=c("red", "blue"), type="l",
> layout=c(2,2))
> dev.off()
>
>
>
> +++++
> This mail has been sent through the MPI for Demographic Rese...{{dropped}}
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
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, UK                Fax:  +44 1865 272595




More information about the R-help mailing list