有没有一种方便的方法来获取格子 y 轴上边界和下边界的标签? (没有设置具体)
library(lattice)
xyplot(decrease ~ treatment, OrchardSprays, ylim=c(0,200))
补充问题:是否可以只设置ylim的上限,下限取默认值?
最佳答案
有一个名为 skip.boundary.labels
的点阵选项。来自 ?lattice.options
下的文档:
skip.boundary.labels
Numeric scalar between 0 and 1. Tick marks that are too close to the limits are not drawn unless explicitly requested. The limits are contracted by this proportion, and anything outside is skipped.
skip.boundary.labels
的默认值为 0.02
,这将防止轴标 checkout 现在 y 轴的最顶部和最底部(以及最x 轴的左侧和右侧)以免被打印。
将 skip.boundary.labels
的值更改为 0
以在轴端打印标签。您可以使用
lattice.options(skip.boundary.labels = 0)
或者,更好的是,使用参数 lattice.options
只为您正在创建的绘图执行此操作:
xyplot(decrease ~ treatment, OrchardSprays, ylim = c(0, 200),
lattice.options = modifyList(lattice.options(),
list(skip.boundary.labels = 0)))
关于r - 在点阵图中的 y 轴上显示 "0"标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27998363/