# Visualizing activity frequency

Hello data analyst community. I have the following problem:

Given a set of n units and a timeline in days. A unit may be active at a certain day to a certain degree (in range from 0.0 to 1.0). A desirable outcome is that if a unit is active, it should be active for a series of consecutive days (or at maximum with one day break).

What I have, of course is the opposite :). Now I want to measure or even better visualize the activity frequencies to "prove" an image-affine person that not all units behave as desired. The brute-force-approach is to draw a line for each unit (along the timeline), colored according to the degree of activity, but since n > 30, the graph is big, colorful and you see nothing at all.

I am afraid that I am searching in the wrong direction. Any ideas, suggestions ?

EDIT: I think I was not able to explain my goal: I do not want to visualize the activity of a singular unit, but getting an idea of the activity frequency of all units involved. In the far end, I will have two groups of units and want to see graphically whether one group performed better than the other (better according to property described above). My apologies for not stating this earlier (thanks to the contributions up to this point, I was able to see what I actually want to know).

You might be trying to incorporate too much information into the graphic. The essence of the visualization seems to be the frequency with which units are active more than one day and, possibly, the times at which those units are active.

Just to generate ideas--because there are many possible solutions--consider a display that provides a clear graphical distinction between the longer-term units and the shorter-term ones and allows assessments of the frequencies with which these occur. One simple solution is a scatterplot where the contiguous activity of a unit between times $x$ and $x + y$ is indicated by a point at $(x,y)$. Modify one salient characteristic of the point, such as its color, to emphasize the distinction between $y \ge 1$ and $y \lt 1$.

Here is a crude illustration: the first plots units on the vertical axis (200 of them), time on the horizontal (75 days; it needs a grid to show the units of time), and unit activities on a gray scale where darker corresponds to longer continuous activity. The second shows similar data as a scatterplot. The latter could be accompanied by a histogram of frequencies. The former ought to have the units sorted vertically by their average length in service.

• (+1) The 1st display really conveys a lot of information, and it will allow to see clusters (wrt. time or individual), if any.
– chl
Sep 30, 2010 at 15:51
• @chl Thanks. But I think it may illustrate some of the problems to which the OP is reacting: it does not clearly show the extent to which units may be active for less than one day. It could be improved in this regard (e.g., by coloring all streaks less than a day long), but it still does not lend itself well to gauging the extent of the problem. What it does provide is the ability to distinguish one unit from another. Displaying the two together on a common time scale suggests that if one single graphic won't do, maybe a collection of related graphics will.
– whuber
Sep 30, 2010 at 15:57
• (+1) because it helped me a lot to find what I actually want to know. Thank you ! Maybe this question can be marked as community wiki, because I dont think there is a definite answer. Oct 29, 2010 at 12:43

How about creating small timelines for each unit, one on top of the other, sorted in order of most to least active? Think sparklines

You could probably do something like highlight the inactive time as either a shaded portion of the chart, or a colored portion of the unit's timeline.

Since each unit would have a small plot, you'd be able to see an individual's activity at a given time. And sorting them by activity would show how poorly some units are performing, as the plots get flatter (and/or more full of your inactivity indicator) as you go down the graphic.

I don't have any great ideas on what software to create this with. You might be able to do it with Lattice in R.