【问题标题】:R Base Plot suppress axis line but show ticksR Base Plot 抑制轴线但显示刻度
【发布时间】:2017-03-21 16:28:10
【问题描述】:

我在使用 axis() 函数时遇到以下问题。

 axis(1,
       at=1:length(stringi::stri_rand_strings(21, 15)),
       labels=stringi::stri_rand_strings(21, 15),
       tick=1,
       lwd=1,
       mgp = c(0,1,0),
       col = title_colour,
       col.ticks = title_colour
       ,lty = "solid",
       cex.axis = 1,las=2,cex=0.75)

但我真正需要的是没有连接刻度的连续 x'x 线的刻度:

我如何使用axis()来完成这个??

【问题讨论】:

  • 使用lwd lwd.ticks: axis(1, lwd = 0, lwd.ticks = 1)
  • 我用的是那个。请将其添加为答案。

标签: r plot axis-labels


【解决方案1】:

col 设置为NA,但将col.ticks 设置为一个值:

plot(1, type = 'n', axes = FALSE)
axis(1, c(0.75, 1, 1.25), col = NA, col.ticks = 1)

(请注意我的 reproducibleminimal 示例,尝试将其包含在您的问题中!)

【讨论】:

    猜你喜欢
    • 2021-08-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 2022-08-04
    • 1970-01-01
    • 2012-10-05
    • 1970-01-01
    相关资源
    最近更新 更多