It does exactly what you ask for the function.
Three months, three ticks.
> d[1] [1] "2001-01-01" > d[100] [1] "2001-03-11"
Try it.
r=runif(100) d <- as.Date("2001/1/1") + 70*sort(r) plot(d,r,type="l",xaxt="n") axis.Date(1, at = seq(d[1], d[100], length.out=25), labels = seq(d[1], d[100], length.out=25), format= "%m/%d/%Y", las = 2)
It should be easy to set for week / month / year. You can play with the mar
parameter in ?par
.
source share