简体   繁体   English

如何使用R中的plot()为Y轴中的各个条目添加轴标签

[英]How to add axis labels for individual entries in the Y-axis using plot() in R

I am plotting a series of time intervals against a character vector of a length of 130. Currently, the y-axis labels are numbered from 0-120 by 20s. 我正在针对长度为130的字符向量绘制一系列时间间隔。目前,y轴标签的编号是从0-120到20s。

Is there a way to replace the numbered y-axis labels with text labels that show what variety corresponds to what time interval? 有没有一种方法可以用文本标签替换编号的y轴标签,以显示对应于什么时间间隔的变化?

Here is an image of the plot I'm describing as it currently is: 这是我目前正在描述的情节的图像:

1

You can plot without the labels and then add your custom labels. 您可以在不使用标签的情况下进行绘图,然后添加自定义标签。

plot(1:3,  yaxt = "n")
axis(side = 2, at = 1:3, labels = c("a","b", "c"))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM