When plotting fewer panels than the full grid you get a gap without a panel. Most lattice functions puts the gap in the top right, but I would like to have it in the lower right, as marginal.plot
does (see the picture). Is there a way to make other lattice functions do the same?
I know the panel order is decided by the order of the factor levels of the conditioning variable, or by using the index.cond
argument, but that does not help me here. I have tried to decipher the code of marginal.plot
, but haven't been able to figure it out, so any help is appreciated!
The as.table=
argument is really there to let users specify the corner from which laying down of panels begins (i.e. top-left or bottom-left). It thus gives you only limited and incidental control over where panels are and are not plotted.
For greater control over panel placement, use the skip=
argument (perhaps in concert with as.table=TRUE
):
# 'skip' plotting of the central panel.
# Note: skip <- c(0,0,0,0,1,0,0,0,0) or even 'skip <- 1:9 %in% 5' would also work
skip <- c(F,F,F,F,T,F,F,F,F)
xyplot(lat ~ long | Depth, data = quakes, skip = skip, layout = c(3,3))
The as.table=TRUE
option should do this for most lattice plots by filling in the top row first instead of the bottom row.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With