使用axis()绘制没有刻度的轴

CL.*_*CL. 3 plot axis r

给定一个没有轴的图,我想用来axis添加水平轴。在左侧您可以看到给定的“基线”图,右侧是所需的结果: 基线和预期图

基线图是简单地使用生成的

plot(1, axes = FALSE, main = "Baseline")
Run Code Online (Sandbox Code Playgroud)

问题:如何生成所需的输出?(条件:axis生成图后使用。)

我期望在指定时得到我想要的东西tick = FALSE, labels = FALSE,但这不起作用。下面是我的测试,希望不言自明:

par(mfrow = c(2,2))

plot(1, axes = FALSE, main = "Full axis")
axis(1) # axis, ticks and labels

plot(1, axes = FALSE, main = "No labels")
axis(1, labels = FALSE) # axis, ticks

plot(1, axes = FALSE, main = "No ticks (and no axis)")
axis(1, tick = FALSE) # NO axis (unexpected), labels

plot(1, axes = FALSE, main = "Nothing (instead of axis)")
axis(1, tick = FALSE, labels = FALSE) # nothing - expected: only axis without ticks, without labels
Run Code Online (Sandbox Code Playgroud)

测试

我期望最后一个图能够提供所需的输出,但轴根本没有绘制。显然,ticks = FALSE也抑制了轴本身。

备注:“预期”图是使用生成的

plot(1, axes = FALSE, main = "Expected")
axis(1, at = c(-100, 100))
Run Code Online (Sandbox Code Playgroud)

但我正在寻找一种“更干净”的解决方案,而不是将不需要的蜱虫放置在可见区域之外。

Mar*_*gan 5

其他解决方法是axis(1, lwd.tick=0, labels=FALSE), axis(1, tcl=0, labels=FALSE),分别绘制 0 宽度或 0 长度刻度。@LyzandeR 的解决方案似乎在轴的顶部绘制白色刻度线。所提出的解决box()方案?par似乎不只绘制X轴?