Data Visualization

Visualizing Time with the Double-Time Bar Chart

In my last post I described some of the issues with visualizing cyclical data by hour of day and covered a few examples of different visualization methods that are typically used. This post is more a visualization experiment.

The Context

To start with a little context, for my day job I create a software product called SpatialKey, which is a business intelligence/data visualization tool. We can visualize all sorts of data all sorts of ways, but one of the things we do is show you a histogram of the occurrence of your data by the hour of day. The chart looks something like this:

The Problem

That’s about as simple as you can get, with a single series of data displayed as a bar chart. The section on line charts in my previous post covered some of the problems with these visualizations. I have two issues with this chart:

  • the break in the data between 11pm and midnight
  • the difficulty understanding the context of the time

To summarize, the first problem has to do with being able to understand the trends that occur around midnight (where this chart breaks the data). In this example we can see that data in the evening peaks at 9pm and then declines, but it’s difficult to accurately assess that declining pattern because you have to try to follow the data as it ends on the right edge of the chart and then continues all the way over on the left edge. This is only problematic when something interesting is happening around midnight (or whenever you choose to have your chart begin/end).

The second point about context has to do with the fact that I don’t think about my days as starting at midnight and ending at 11:59pm. A more accurate representation of how I think of my days is that they start sometime when I wake up, usually around 7am, and they are broken up into “day-time” and “night-time”, and they end more or less when I go to sleep. Within “day-time” my day is broken up into other categorizations, like “working hours”, “afternoon”, “lunch-time”, etc. And depending on the data in question, these contextual relationships might be incredibly important. For this post I’ll be looking at crime data. When you’re investigating crime data, the contextual relationship to the time of day can be incredibly relevant. I don’t just want to know about when people are assaulted, I want to know the rate of assaults on the street when I’m going to be walking on the street (typically right after work on my way home, or later at night going out to dinner, bars, etc).

The simple bar chart doesn’t solve these problems well. It presents a hard break in the data, forcing the viewer to mentally connect the end of the chart with the beginning. And it also forces the viewer to think about the days in the context of midnight – 11pm, which is not the natural categorization system we have for the hours of the day.

The Double-Time Bar Chart

My first attempt to address some of these problems is something I’m tentatively calling the Double-Time Bar Chart. The goal is to put the time in context a bit more for the viewer, and to always show a relevant, continuous visualization of all times of the day.

The chart still uses simple bars in a linear chart. But the data is actually shown twice in the chart. The top part of the chart is the exact same histogram chart with 24 bars that we had before, going from midnight to 11pm. The bottom part is the same data (upside down), but it starts instead at noon and goes to 11am. It’s shifted by 12 hours compared to the top chart. Imagine taking the top chart, flipping it upside down, then shifting it over to the right by 12 bars.

There’s a single x-axis for both the top and bottom charts, which is labelled with the hours of the day. But the hours are either AM for the top chart or PM for the bottom chart.

The highlighted regions represent 6am-5pm on the top and 6pm-5am on the bottom. That means there are 24 highlighted bars, so the highlighted bars represent one unduplicated set of 24 hours of data. The highlight is used to draw attention to day-time and night-time activities. A very rough color categorization is used to color 6am-5pm in a lighter yellow, representing day-time, and 6pm-5am in a darker color, representing night. I realize this doesn’t match up with actual sunlight/darkness times in most cities, but I think the 6am-6pm time range is close enough to how many people think about “day” vs “night” that it works.

The duplicated (but shifted) data in the top and bottom allows me to see a continuous, unbroken series of data that can show day-time activity (top) or night-time activity (bottom). There is no hour of the day that forces me to read the chart to the end and then continue on by moving my attention back to the beginning. If I’m interested in the trends during the day (say around lunchtime, so 11am-1pm) then I can read the top chart. But if I’m interested in night-time activity (say 11pm-1am) then I can read the bottom chart. In both cases I get a continuous chart that shows the full context of all the data around the range in which I’m interested.

The highlighted regions serve to draw attention to daytime versus nighttime, but we still keep the rest of the 24 hours visible in each chart (the unhighlighted bars) so you can always get the full context of the data. This allows you to follow the data from 4pm-8pm without forcing your eyes to jump from the top to the bottom.


For these examples I’ll be visualizing crime data from the city of San Francisco. I’m using two full years of crime, 2009 and 2010. You can download the crime data yourself if you want to play with it.

One note about these charts: there are no y-axis labels and each chart is relative to itself. I was interested in exploring the problem of visualizing the hourly patterns, not necessarily being able to know exactly how many crimes occurred at a certain hour. The highest bar in each chart does not always mean the same value. It simply means that’s the hour with the most crimes for that particular crime type.

Here’s an example of a crime the has an interesting day-time pattern, burglary. Notice the nice peak right when everyone leaves their homes unguarded as they go off to work.

And here’s a contrasting example of a crime that’s primarily a night-time activity, public intoxication.

Notice the nice nearly-linear build up all the way from about 9am up to the peak at midnight, then the dropoff after 2am (when the bars close in San Francisco).

There are a few crimes that are even more polarized. Arrests for driving under the influence have a nice distribution curve that peaks at midnight.

And prostitution is also primarily a night-time activity in San Francisco. There are two peaks, one just after work around 6-7pm, and then another a bit later in the evening at 11pm.

Small Multiples for Comparison

One way to compare different kinds of data is to use small multiples, which relies on small charts all laid out together to make it easy for your eyes to scan. These Double-Time charts work well in small multiples because you can quickly scan to see the difference between predominantly daytime crimes (large yellow areas in the top half) versus night-time crimes (blue areas in the bottom half). For instance, to get a better view of burglary, we can look at the sub-categorizations.

We can see that residential burglaries occur in the morning when people leave for work, whereas burglaries of a store are either late-afternoon or evening crimes.

The same approach can be used to compare many different types of crimes:

Or we can remove the x-axis and strip down the extra whitespace in the charts to get an even more compact view:

Summary/Revisiting the Goals

Now to circle back around to what I was trying to accomplish with this type of chart. There were two main goals: preserving the continuity of the data and putting the data into the context of your day.

To preserve continuity I’ve duplicated the data, which allows for a nice continuous linear chart that covers any important time range. If you’re interested in day-time trends you can look at the top chart. If you’re interested in night-time trends you can look at the bottom chart. But in either case you get a full, continuous range to put the trend in context.

To further put the data in context I’ve added some simple coloring to highlight the day-time vs night-time ranges. The x-axis labels (showing 6am, noon, 6pm, etc) give you some further context that helps you categorize the data. If you split the chart in quadrants you get rough categories for morning (top-left), afternoon (top-right), evening (bottom-left) and night (bottom-right).

The Big Caveat

This is just a simple design experiment. I’m making no claims about the efficacy of this chart. I have not run any studies to validate that this chart is clear to viewers or is any better (or worse) than any other visualization. I don’t even know if I myself think this is an effective chart. I’m just trying to spur a bit of a discussion and some experimentation around the problem of visualizing cyclical hourly data. So what do you think?

I’ll be posting another (even more experimental) take on this same topic shortly.


8 thoughts on “Visualizing Time with the Double-Time Bar Chart

  1. Sam D says:

    This is an interesting experiment. I’ve never had the need to visualize 24-hour/clock based data, so I’m of no help.. but I can give you my 2 cents for whatever it’s worth:

    After reading through your explanation I think this is a tidy solution. By the time I got to your small-multiples I was able to digest the information quickly and easily. It drew me in, it’s attractive (an important aspect I think), and it transmits the data well.

    I do however wonder what I would think if I just jumped to the end skipping the explanation. I don’t think I’d understand what I was staring at – but I suspect you know that. So I think the challenge is to explain how the graphic works without using much of your user’s time. The main leap is that the “negative” (downward) bars have a “positive” meaning on the same scale as the upward bars. (This kind of thing will give the Stephen Few’s of the world an aneurysm..). However I suspect a 10 second animation that starts with the original histogram, flips it, then shifts the bottom – followed by some annotation, would be all that’s needed. But maybe that’s too much to ask a user?

    So I think that’s the challenge – but if you clear that hurdle, I think this is a pretty effective way to look at this. Particularly because it makes me want to explore more of this data in this form… I’d browse just out of curiosity, so at least in that sense I think it’s a successful start.

  2. Fedlarm says:

    Im certainly not an expert on graphs. However this was interesting reading to me. The first thing that caught me was the compact views. They kind of look ligk a city, with a reflection in the water. A bit like this image:

    Ideologically a nice way to show a city’s, day and night time, data.Try flipping the nighttime horizontally. I think the chart will become easier to read, and as a side effect become better looking esthetically towards the skyline/water-reflection theme.

    But again, just an idéa, might be confusing and at best illogical 😛

  3. I didn’t see mention of any constraints that would lead you to not use a cyclical representation. Was there some impetus to keep it linear as opposed to the logical and cognitively congruent circular, clock, or polar representation?

    • Tom – that’s a great point. I have a few points about cyclical charts. First, I’m planning on experimenting with cyclical charts in the future, so stay tuned for some more circular experiments.

      But I do have a problem with circular representations, which is that I don’t think they provide good context for different times of the day. Circular representations typically show all 24 hours on one circle and start with 12am at the top of the circle. That means that “morning” is roughly in the bottom right section, afternoon is the bottom left section, evening is the top-left and late-night is the top-right. There’s nothing inherently bad with that, but I don’t think it’s intuitive to know where to look to find the trend for a given time of day you’re interested in. If I know I’m interested in crimes that occur in the morning, for instance, I have to know to look somewhere along the bottom-right side of the circle. Whereas with linear charts you can frame the data within the context of the day. My chart frames the day so you can easily pick out different times of day, like morning (the start of the top highlighted range).

      A second point is that people may not intuitively think in circular forms, but instead in linear forms. There’s a dissertation that tried to study this concept, and they found that when asked to draw cycles (like the seasons of the year, etc), the majority of people drew them linearly, not circularly. While I’m not saying this one small study proves anything about whether linear representations are better than circular representations, I find the concept fascinating. Personally I do find reading linear charts to be very intuitive, and I think I struggle a bit trying to understand circular ones. So I wanted to try my hand at a linear representation.

  4. Richard Williams says:

    ‘the difficulty understanding the context of the time’

    Despite Einstein’s theories being a century old now (well nearly) you are not alone, most people still consider time as linear, unchanging and constant. Indeed time as most people think of it is
    a human concept.

    Let’s look at your linear charts–comparing data from say 11am every day over a year–But 11am is not the ‘same time’ throughout the year. Not only do our clocks change during several times of the year, but considerations such as the length of daylight alters dramatically at different times of the year, along with many more variables, all of which can affect any kind of data accumulation like this. Take you DUI example–It’s no coincidence that in most States, more accidents occur in Winter than in Summer (including DUIs) with the effect of diminishing sunlight an obvious factor.

  5. ash says:

    The bars going up are bad…no wait, the bars going down are bad. This chart requires a context switch when you compare day vs night. Also, maybe focusing on the ‘unit of a day’ is a problem. Kinda like focusing on a tree instead of the forest. String together a week and I can easily see the cyclic ups and downs, I can see a pattern in day vs night. Instead of 1 day and N categories in a row, why not 1 category, 1 week, in 1 row. With each category per row, there’s opportunity to not only see the cycles, but to compare cycles against other crimes, to overlay.

  6. I’m with Ash: I am confused about the antiparallel directions of the bars in your proposed chart. Even after consciously telling myself that both directions are positive, I am confused.

    If you were to simply make two panels in a similar fashion, but make both panels start at the bottom and values increase in the upward direction, it would eliminate this confusion.

Comments are closed.