First, convert your selected dates from character
to Date
(using the right format string):
MyDates <- as.Date(MyDates, format = "%m/%d/%y")
# [1] "2012-03-03" "2013-04-27" "2012-10-20" "2013-05-08"
class(MyDates)
# [1] "Date"
Then you can add your axis with ticks at those points only:
axis.Date(side = 1, at = MyDates, format = "%b %y", las = 2)
That short axis looks ugly? Add the first and last date:
axis.Date(side = 1, at = c(min(dates), MyDates, max(dates)), format = "%b %y", las = 2)
Want to stretch the axis but not have the first/last labels? Don't print them:
axis.Date(side = 1, at = c(min(dates), MyDates, max(dates)),
labels = c("", format(MyDates, "%b %y"), ""), las = 2)
Or instead, draw a long axis first without labels:
axis.Date(side = 1, at = c(min(dates), max(dates)), labels=FALSE)
axis.Date(side = 1, at = MyDates, format = "%b %y", las = 2)
Vertical lines:
abline(v=MyDates)
abline(v=MyDates, lty="dashed", col="red")
# etc.