Controlling the number of panels in a lattice plot with R

lattice, plot, r

Solution

Have a look at the `layout` parameter.

Maybe you want something like:

xyplot(Predicted_value + Actual_value ~ x_value | State_CD, data=dd, layout = c(4,5))

Problem

How do I limit the number of panels shown on a single page using lattice? I am graphing the results of a regression for multiple states and putting 50 of these on a single page makes them unreadable. I would like to limit the output to 4 wide and as many tall as needed. Here's my lattice code: ``` xyplot(Predicted_value + Actual_value ~ x_value | State_CD, data=dd) ``` There are 50 different values for State_CD

Original source