在应用useOuterStrips时,避免y轴重叠因子条? {} latticeExtra

时间:2016-03-14 20:26:06

标签: r plot lattice

我有两个因素的组合图。因为我使用双Y刻度,我不能轻易使用ggplot2,所以我使用{lattice}。

当我在边缘(通过useOuterStrips)应用我的条带时,我的Y比例与带有因子名称的条带重叠。我怎样才能避免重叠?是否还有一种方法可以在图的左侧切换var2的条带?

我的虚拟数据:

mtcars$HP <- equal.count(mtcars$hp)
a<-useOuterStrips(xyplot(mpg ~ disp | factor(cyl) + HP, mtcars),
               strip.left = TRUE,
               strip = strip.custom(style = 4),)

b<-useOuterStrips(xyplot(qsec ~ disp | factor(cyl) + HP, mtcars),
                  strip.left = TRUE,
                  strip = strip.custom(style = 4),)

doubleYScale(a,b,  add.ylab2=TRUE)  

enter image description here

1 个答案:

答案 0 :(得分:0)

记录这是一个可怕的想法 - 有一个原因它没有在ggplot2中实现。可能有更好的方式来展示您的需求。

重新解决重叠问题,你可以用

之类的东西修复它

update(p, par.settings = list( layout.widths = list(left.padding = 10)))

欢呼声

相关问题