R基本图抑制轴线,但显示刻度 [英] R Base Plot suppress axis line but show ticks

查看:50
本文介绍了R基本图抑制轴线,但显示刻度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

axis()函数出现以下问题.

I am having the following issue with the axis() function.

 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线连接刻度线的刻度线:

But whatI really need are the tickmarks without the continuous x'x line connecting the ticks:

如何使用axis()完成此操作?

How do I accomplish this using axis()??

推荐答案

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

Set col to NA but col.ticks to a value:

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

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

(Note my reproducible and minimal example, try to include that in your question!)

这篇关于R基本图抑制轴线,但显示刻度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆