I had to visualize an hourly distribution of some KPI (assume logins / registrations / purchases per hour), so the idea was, why not build a clock? It’s a nice and intuitive way to present this data. The problem is, that the clock has only 12 hours which are used twice a day, so I will have to assign two data points to every “hour” (am/pm). So assume our data is something like this:
So with ggplot we can start with some bar plots:
Neat, but doesn’t look like a clock to me, so let’s change the coordinates to polar:
Well, better, looks like a clock, but won’t win any beauty contests. Let’s skew it and remove some junk.
Nice! That’s the data clock. From a design and readability point of view the transition from a.m to p.m (left bar to right bar) and p.m. to a.m. (right bar to left bar) at 11-12 o’clock could be misleading or counterintuitive. My suggestion here is to guide the viewer with color transitions, instead of binary a.m./ p.m. (red / blue) colors. One way to do this is by adding a new variable to the data, to which we then can bind our color to.
Now we have to adjust the aesthetics of ggplot a bit and we’re done.
Delete the useless legend et voilà!
One has to mention, that p.m. is on the right side and a.m. is on the left. Sure, it’s still not perfect, because the transition between a.m./p.m. is still rough, so I would be delighted to read your suggestions for improvement in the comments ;)comments powered by Disqus