我想用4个不同的面板创建一个格子图。其中2个面板应为2个盒子,而另外2个面板应为3个盒子。莱迪思自动在前两个面板中绘制一个空行(见下图)。我怎么能删除这个空行/空格,以便在前两个面板中只显示line_a和line_b?
示例:
library("lattice")
set.seed(123)
N <- 2000
dat_a_b <- data.frame(x = rnorm(N),
lines = c(rep("line_a", N / 2),
rep("line_b", N / 2)),
head1 = rep(c(rep("head1_a", N / 4),
rep("head1_b", N / 4)), 2),
head2 = rep(c(rep("head2_a", N / 8),
rep("head2_b", N / 8)), 4))
dat_c <- data.frame(x = rnorm(N / 2, 5),
lines = rep("line_c", N / 2),
head1 = rep(c(rep("head1_a", N / 8),
rep("head1_b", N / 8)), 2),
head2 = rep("head2_a", N / 2))
dat_all <- rbind(dat_a_b, dat_c)
bwplot(x = lines ~ x | head1 * head2, data = dat_all)
当前图表:
提前多多感谢!
答案 0 :(得分:1)
将y轴的比例设置为“free”:
bwplot(x = lines ~ x | head1 * head2, data = dat_all,
scales = list(y = "free"))