lattice
Lattice: multiple plots in one window?
The ‘lattice’ package is built on the grid package and attaches its namespace when ‘lattice’ loaded. However, in order to use the grid.layout function, you need to explicitly load() pkg::grid. The other alternative, that is probably easier, is the grid.arrange function in pkg::gridExtra: install.packages(“gridExtra”) require(gridExtra) # also loads grid require(lattice) x <- seq(pi/4, 5 * … Read more
How to plot a function curve in R
I did some searching on the web, and this are some ways that I found: The easiest way is using curve without predefined function curve(x^2, from=1, to=50, , xlab=”x”, ylab=”y”) You can also use curve when you have a predfined function eq = function(x){x*x} curve(eq, from=1, to=50, xlab=”x”, ylab=”y”) If you want to use ggplot, … Read more
How to save a plot as image on the disk?
There are two closely-related questions, and an answer for each. 1. An image will be generated in future in my script, how do I save it to disk? To save a plot, you need to do the following: Open a device, using png(), bmp(), pdf() or similar Plot your model Close the device using dev.off() … Read more