简体   繁体   English

在绘图线上加数字

[英]adding numbers on the lines of a plot

I am making a plot as follows: 我正在绘制以下情节:

plot(df$time,df$response,type='o',ylim=c(2.1,2.8),col='black',xlab='Time (h)',ylab='response(L)')
points(df$time,df$res,type='o',col='black')
points(df$time,df$res,type='o',col='black')

here I used type='o' to indicate that the lines are with circles at each time point. 在这里,我使用type='o'来表示线条在每个时间点都带有圆圈。 But I wish to replace the circles with numbers. 但我想用数字代替圆圈。 Like the first line is 1, the second is 2, and the third is 3. Is there a way to realized this? 就像第一行是1,第二行是2,第三行是3。有没有办法实现这一点?

You can set pch equal to the number or use the text() function, depending on your needs. 您可以根据需要将pch设置为等于数字或使用text()函数。 You might also look at this post . 您可能还会看这篇文章

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

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