在点阵图中 y-axis 上显示“0”标签
show "0" label on y-axis in lattice plot
有没有一种方便的方法来获取格子中上下边框的标签y-axis? (没有设置具体)
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
,这将防止轴标签出现在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)))
有没有一种方便的方法来获取格子中上下边框的标签y-axis? (没有设置具体)
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
,这将防止轴标签出现在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)))