Thank you very much. In addition to what your did, for event 1, I would like to draw a horizontal line connecting from day 1 to day 2 to day 3 to day 4. Then, for event 2, I would like to draw a horizontal line connecting from day 1 to day 2 to day 3 to day 4. Similarly for events 3, and 4. Is that convenient to do? Greg Coats
> On Mar 16, 2021, at 8:01 PM, Avi Gross via R-help <r-help@r-project.org> > wrote: > > Here is an example that worked for me doing roughly what I mentioned but > note my names changed. It makes two plots. > > library (ggplot2) > myDat <- read.table(text = > "datetimeraw > 2021-03-12 05:16:46 > 2021-03-12 09:17:02 > 2021-03-12 13:31:43 > 2021-03-12 22:00:32 > 2021-03-13 09:21:43 > 2021-03-13 13:51:12 > 2021-03-13 18:03:13 > 2021-03-13 22:20:28 > 2021-03-14 08:59:03 > 2021-03-14 13:15:56 > 2021-03-14 17:25:23 > 2021-03-14 21:36:26", > sep = ",", header = TRUE) > head(myDat) > myDat$datetime <- as.POSIXct(myDat$datetimeraw, tz = "", format ="%Y-%M-%d > %H:%M:%OS") > myDat$date <- factor(format(myDat$datetime, "%Y-%m-%d")) > myDat$time <- format(myDat$datetime, "%H:%M") > myDat$seq <- factor(rep(1:4, 3)) > > # just dots > ggplot(data=myDat,aes(x=date, y=time)) + geom_point(aes(color=seq)) > > # Also text > ggplot(data=myDat,aes(x=date, y=time, label=time)) + > geom_point(aes(color=seq)) + > geom_text(aes(color=seq)) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.