Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.7K Views
|
6 Replies
|
1 Total Like
View groups...
Share
Share this post:

Inconsistent TimelinePlot Layout when using time intervals

Posted 4 years ago
Attachment

Attachments:
POSTED BY: Dave Middleton
6 Replies
Posted 4 years ago

Another way to remove the List

First /@ data // TimelinePlot

where data = the association.

POSTED BY: Rohit Namjoshi
Posted 4 years ago

Hi Rohit,

Thanks for the response. The answer is yes, but there is a bit of a story to it.

I already created concurrent user plots over time, which I named Attendance Charts/Plots. Since I collected a lot of data, these charts have more detail than the one in your link:https://community.wolfram.com/groups/-/m/t/1705346

I had one chart left on my wish list: a "Gantt" chart (timeline) of attendance which I can use to review who signed-in and signed-out and when. This is the plot I shared.

The code I use is:

AttendanceTimeline[d_Dataset] := Module[{data, l, tlp},
  data = Query[GroupBy[#Name &], All, #Intervals &]@d;
  l = Length@data;
  ticks = Transpose[{Range[l], Normal@Keys@data}];
  tlp = TimelinePlot[
    DateInterval /@ 
     Flatten[Normal@
       Values@Query[GroupBy[#Name &], All, #Intervals &]@d, 1], 
    PlotStyle -> RGBColor[
     0.5058824656863051, 0.41960714747751615`, 0.28627398412570204`], 
    PlotLayout -> "Stacked"];
  Show[tlp, Frame -> {{True, True}, {True, True}}, 
   Options[tlp, FrameTicks] /. {None, None} -> {ticks, None}, 
   AspectRatio -> 1, GridLines -> {Automatic, Range[l]}, 
   GridLinesStyle -> Directive[
RGBColor[0.8784316204832701, 0.8392150364732718, 0.7529403241427501]]]
  ]

It uses a Dataset of participant names, Date (optional, superfluous but handy) and join-leave DateInterval (List). The latter was giving me trouble when creating a TimelinePlot.

Also I found this link on StackExchang which was of great help too: https://mathematica.stackexchange.com/questions/151128/timelineplot-y-axis-misaligned

Anyway, if you are interested in how to analyze conferencing usage logs (e.g. Zoom or Teams), with visualization, I have to write a separate post on this topic.

Cheers,

Dave

POSTED BY: Dave Middleton
Posted 4 years ago

Hi Dave,

Nice! Would you mind sharing your solution so others can benefit from it in the future? I am guessing you did something like

data // Values // Flatten[#, 1] & // TimelinePlot

If you want to compute the number of concurrent viewers over time, take a look at this.

POSTED BY: Rohit Namjoshi
Posted 4 years ago

Thanks everyone for the suggestions.

I reviewed my code with fresh eyes, found the issues and solved it (see example for many intervals).

Attachment

Attachments:
POSTED BY: Dave Middleton

Yes, definitely the better way - in Association keys are "transparent"!

POSTED BY: Henrik Schachner

Dave,

probably not the solution, but a problem could be that your time intervals are included in List; try:

assoc = <|  --- your association --- |>
assoc1 = Association@KeyValueMap[#1 -> First[#2] &, assoc];
TimelinePlot[assoc1]

enter image description here

POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard