pir
pir

Reputation: 5933

Lattice xyplot - Matrix used to divide groups into subplots

I have a lattice xyplot with a group argument. There are 5 different values for the variable used to group and the plot is divided into a 2x3 matrix with an empty box in the upper right corner. However, I would like to divide the plot into a 1x5 matrix instead. How can I do that?

Here is my code:

   xyplot(prop ~ indtegn_alder | salgskanal,
   data=fewGrid2,type='smooth',span=0.20, lwd=2.5,
   xlab="Alder", ylab="Sandsynlighed", ylim=c(0,0.5), group= first_kundetype)

Upvotes: 1

Views: 451

Answers (1)

MrFlick
MrFlick

Reputation: 206546

See the layout= parameter on the ?xyplot help page.It allows you to specify the number of columns and rows you would like

xyplot(prop ~ indtegn_alder | salgskanal,
data=fewGrid2,type='smooth',span=0.20, lwd=2.5,
xlab="Alder", ylab="Sandsynlighed", ylim=c(0,0.5), group= first_kundetype,
layout=c(1,5))

Upvotes: 1

Related Questions