Time Series Visualisation

Tags:  

In order to display both the trends and the detail of 580 time series observations a heatmap was created displaying each day as a square.  Colours were assigned to each square in order to indicate the number of jobs advertised — the higher the number of jobs, the darker the value.

Time series heat map

The graphs show the daily number of IT jobs advertised in Canberra over a 28 month period. The darker the colour the more jobs advertised. Colours was created using R’s colorRampPalette() function — 40 colours were generated. Colours were then assigned with the classIntervals() function using the Fisher-Jenks algorithm.

Observable Trends

Its quite easy to notice that the early part of 2012 was a much better time to be looking for an IT job than in 2013.  There does not seem as though there is any pattern associated with the day of week.

Underneath each column of cells, a weekly average was calculated, helping to identify any temporal pattern.

Long Term Trends

The graph below displays the same data for entire time period in a single graph.  As can be seen, the job market is starting to recover albeit quite sporadically.

Bar Chart Time Series

The graph shows weekly averages for IT jobs advertised in Canberra. The average number of jobs was calculated for each week. An average was calculated for the entire series and this was subtracted from the weekly averages. R’s GGPlot2 was used to construct the graph with Adobe Illustrator used for some fairly minor enhancements.

Implementation in R

The calendar visualisation used base R graphics and is based on a post by Nathan Yau .  The classInt library was used to interpolate between two different colours.  This was used to determine the appropriate colour for each of the (52 x 5) 260 squares used to represent each workday.  The programming used to create this graphic uses fairly low level R code. The code and the associated data for this graphic can be found here. 

The monthly summaries (underneath the calendar heatmap) were created using GGPlot2.  The long term trends was also created using GGPlot2.  Even this type of column graph is a fairly standard method to graph data, using a statistical and a graphical program together means that data can be easily binned, averages can be calculated, certain days (i.e. weekends) can be excluded and after these calculations, the results can be visualised. The code and the associated data for these visualisations can be found here and here. 

Vector Graphic Compositing Using Adobe Illustrator

R enables graphics to be (usually) output as vector graphics contained in a PDF wrapper.  These files can be easily opened and edited using Adobe Illustrator (and other vector graphic programs such as Inkscape ) .  This allows different graphics to be combined as in the first graphic where a heat map was combined with a line graph.  It also allows minor changes to be made such as changing or adding titles and legends.

Programming + Graphics = Insights

Creating data visualisations requires a few different skills. Obviously, understanding good design principles is important but so too is programming.  Programming enables the practitioner to ask many different questions about the data: does it have a high degree of variance; is it increasing or decreasing; what’s the average.  Depending on the answers to these questions, more appropriate graphical techniques can be selected.

Rapid Graphic Creation Using Programming

Programming also enables a framework to be established where a large number of graphics are programmatically created and then inspected in order to determine patterns.  GGPlot2 formalises this using a technique called faceting where combinations of discrete variables are plotted within a single graph. Programming also allow many different graphical combinations of data to be generated.  By filtering or aggregating or combining data, thousands of combinations can be created and then these can be viewed in order to determine patterns or trends.

Github Code and Data

The code and data for the examples above are available here.

OctocatSmall