Controlling placement of empty lattice panels

不打扰是莪最后的温柔 提交于 2019-12-22 05:23:43

问题


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!


回答1:


The as.table=TRUE option should do this for most lattice plots by filling in the top row first instead of the bottom row.




回答2:


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))



来源:https://stackoverflow.com/questions/11468072/controlling-placement-of-empty-lattice-panels

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!