# How to visualize a series of time differences?

Question: Given a series of times how can we visualize the time between dates?

Context

I have data of the following structure:

{{"2018-07-31 21:32:52", "2018-07-31 22:12:27",
Quantity[0.0274884, "Days"]}, {"2018-08-02 19:11:59",
"2018-08-02 19:12:40",
Quantity[0.000474537, "Days"]}, {"2018-08-02 19:12:40",
"2018-08-07 20:35:19",
Quantity[5.0574, "Days"]}, {"2018-08-07 20:36:05",
"2018-08-07 20:36:05", Quantity[0, "Days"]}, {"2018-08-07 20:36:46",
"2018-08-07 20:36:46",
Quantity[0, "Days"]}, {"2018-08-08 18:46:26", "2018-08-08 18:46:54",
Quantity[0.000324074, "Days"]}, {"2018-08-08 18:46:54",
"2018-08-08 18:47:34",
Quantity[0.000462963, "Days"]}, {"2018-08-08 18:47:34",
"2018-08-08 18:54:15",
Quantity[0.0046412, "Days"]}, {"2018-08-08 18:54:49",
"2018-08-08 18:54:49", Quantity[0, "Days"]}, {"2018-08-08 18:55:55",
"2018-08-08 18:55:55", Quantity[0, "Days"]}}


A list containing a list of two dates as the first element and their difference, as the second element. This data is derived from user interactions to a series of questions and we want to know how long it took to respond in minutes.

What I've Tried

So, I have tried to create a Grid to display the data where every two rows, we display the difference. However, this doesn't have an immediate visual effect that a graph might.

I have also considered using TimelinePlot which has an "Interval" capability. I did the following:

TimelinePlot[DateObject[#]& /@ listOfDates]


which produces something somewhat meaningful (see graphic) but some dates are vertically stacked where, I think, everything horizontal would be better.

• Aren't you just looking for a histogram of user response times ? Or even a simple scatter plot ? I'm not sure this is a programming question, it seems more like a data visualisation design question. – High Performance Mark Mar 27 at 9:13
• I don't really understand your explanation of the data structure. What I see here is just a list of dates. I don't see a list of lists and I don't see any differences. – Sjoerd Smit Mar 27 at 10:10
• @SjoerdSmit, I've updated the question to include a new data structure which includes dates and their time differences. – Jeel Shah Mar 27 at 11:10
• @HighPerformanceMark A histogram / scatter plot won't do because I would like something like a timeline except the points shouldn't be stacked. – Jeel Shah Mar 27 at 11:11
• The list in your answer is not valid Mathematica code someone can copy and paste in a notebook. Can you include the definition of listOfDates (or at least: a definition of the first 5 elements or so) that people can use directly? You can just evaluate listOfDates[[;; 5]] and paste the results in here. – Sjoerd Smit Mar 27 at 11:21

I have decided to use a TimelinePlot. I have a list of dates like:

listOfDates = {"2018-07-31 21:32:52", "2018-07-31 22:12:27", ...}


In order to visualize the times for the data, I converted each time to a TimeObject

TimeObject[#] & /@ listOfDates


And then plot each of them using a TimelinePlot. The important part was PlotLayout -> "Stacked". This generates a plot where each event has it's own row. So we visualize difference by the distance between dots.

The final function is:

TimelinePlot[TimeObject[#] & /@ listOfDates, PlotLayout -> "Stacked"]


And we ultimately end up with something like: