当我在 R 中为绘图设置限制时,我设置的限制与绘图区域的实际限制之间存在一些距离:
plot(c(1, 4), c(1, 4), ylim = c(1, 4))
Run Code Online (Sandbox Code Playgroud)

当然,我可以在最外面的刻度内设置限制,使它们看起来接近绘图区域的边缘。通过单独绘制轴并允许将其绘制在绘图区域之外,我可以非常接近:
plot(c(1, 4), c(1, 4), ylim = c(1.2, 3.8), axes = FALSE)
par(xpd = TRUE)
abline(h = 4, col = "grey") # just to show the edge of the box
axis(2, at=c(1, 4), labels = c(1, 4))
Run Code Online (Sandbox Code Playgroud)

但这只是眼睁睁地看着它。所以:
如何让最外面的刻度恰好落在绘图区域的边界上?
| 归档时间: |
|
| 查看次数: |
2242 次 |
| 最近记录: |