awend
awend

Reputation: 107

How to make short lines on X axis in R

I'm trying a plot where I have small ticks on the X-axis. So instead of these long vertical lines I just want them on the X-axis like the example. Is there a function for this in R?

Example code:

x <- cos(seq(0,20,0.1))+rnorm(201,mean=0,sd=0.5)
lines <- seq(1,201,10)
plot(x)
abline(v=lines)

Want it to look like this

Example picture

Upvotes: 0

Views: 321

Answers (1)

dww
dww

Reputation: 31452

You are looking for rug

x <- cos(seq(0,20,0.1))+rnorm(201,mean=0,sd=0.5)
lines <- seq(1,201,10)
plot(x)
rug(lines)

enter image description here

Upvotes: 1

Related Questions