I am new to R and ggplot2 and I was wondering how can I produce a timeline plotting points at a given time using R? I am also having some trouble with the dates I have. (I’m
Why not this:
>YearMonth = c(200506,200509)
>dt = as.POSIXct(strptime(paste0(YearMonth, 15), "%Y%m%d"))
>z = rep(0, length(dt))
>y = rep(c(-1,1), out=length(dt))
>plot(dt,y, axes=FALSE, ylab="", xlim=c(min(dt)-10e6, max(dt)+10e6), ylim=c(-2,2), pch=15, col="darkblue", xlab="Date")
>arrows(x0=dt,y0= z, x1=dt, y1=y, length=0, angle=30, col="blue")
>arrows(min(dt), 0, max(dt), length=0, col="blue")
>text(dt, y*1.5, c("Ben Franklin arose\nfrom the dead", "Atlantis found"), adj=1)
>axis.POSIXct(1, dt, format="%y/%m")
>dt
[1] "2005-06-15 EDT" "2005-09-15 EDT"