Visualizing Time series Data

This post has two goals. I hope to make you think about your graphics, and think about the future of data-visualization. An example is given using some simulated time series data. A very quick read.

In visualization, like in programming, presentation or any other skill, there is much to learn. Also like in other skills, there is no one best way of doing things. Rather, creating a good chart is task-specific, with many ways of achieving appealing, but also appalling results.

I recently finished reading An Economist’s Guide to Visualizing Data, which made me think about writing this. It is a paper from 2014 published in Journal of Economic Perspective, which talks about effective ways of presenting data. It outlines three principles: show the data, reduce the clutter and integrate the text and the graph. There are more of course, including those easy-to-follow 20 recommendations. Some more practical and more theoretical information in the references below.

Here is one thought process on the way to effective visualization. The last chart is more modern. I would already expect to see its kind in a 2014 paper, alas.
It uses javascript under the hood. Those kind of dynamic graphics are the future of visualization, period.

The following chart is for your eyes only. It is created using the very basic matplot function:

Only for self consumption, you can’t really show it to anyone

Visualizing Time Series Data 1
We can present each series in its own box:

Individual series


That’s not great, the y-axes above are not aligned, and it may be useful to compare the series which is hard to do still.

We can add the other series and color them differently:

Using different colors


This is better but still somewhat messy. Hard to distinguish between the series.

We can bold the relevant series:

Relevant series in bold

Owing to the third principle from the aforementioned 2014 paper, we can remove clutter. Charts can share the same axes:

Less cluttered


While this looks as something we can proudly present. We can do better with a dynamic chart.

The disadvantage of a dynamic chart is that it’s not for printing (you can snapshot, but it defeats the purpose). It is meant for digesting using something smarter than an A4. It is my experience that people still like to bring, and look at hard copies. However, this will change as the cost of excellent tablets inevitably drops, along with their weight.

The dygraphs package is needed here. Once installed (simply type install.packages("dygraphs")), R can now play with JS very nicely.

Dynamic chart

Click on the “Hide Toolbars” button to see exactly the values of the series.

You can zoom in on specific observations. You can drag across a window using the range selector at the bottom. Double click to reset. What more you can ask for?

References

The Visual Display of Quantitative Information

Some interesting boxplot charts
The Elements of Graphing Data

Help me help you

One comment on “Visualizing Time series Data”

Leave a Reply

Your email address will not be published.