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