Re: [R] Help : trellis.device

About this list Date view Thread view Subject view Author view Attachment view

From: Jason Turner (jasont@indigoindustrial.co.nz)
Date: Wed 19 May 2004 - 23:03:24 EST


Message-id: <26686.203.9.176.60.1084885404.squirrel@webmail.maxnet.co.nz>


> Hi, R members.
>
> I want to save plots. So I use the R as fallows :
> --------------------------------
> a <- c(1,10)
> b <- c(1,10)
> c <- c(2,20)
> d <- c(2,20)
> require(lattice)
> trellis.device("bmp", file = "test.bmp", bg = "white")
> print(plot(a,b))
> print(plot(c,d))
> dev.off()
> --------------------------------
>
> However, I got a image of plot(c,d).
> I want to get a image of plot(a,b) and plot(c,d).

What happens when you type the above without "trellis.device(...)" and
"dev.off()". Does that look like the plot you wrote to file?

R is one of those funny software tools that does what you tell it.

1) "plot()" isn't a lattice function, so using the function "bmp(file =
"test.bmp", bg = "white")" instead of "trellis.device()" is safer.

2) you haven't told R that you want two plots on one page, nor how you
want to arrange them. See ?layout and ?par. On the par help page, pay
careful attention to the mfcol and mfrow arguments.

3) type "help.start()", and follow the link to "An Introduction to R",
particularly the graphics section.

Then play with this.

par(mfcol=c(2,1))

plot(a,b)
plot(c,d)

Have fun!

Jason

______________________________________________
R-help@stat.math.ethz.ch 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


About this list Date view Thread view Subject view Author view Attachment view

This archive was generated by hypermail 2.1.3 : Mon 31 May 2004 - 23:05:11 EST