Visualising Data in 3 Dimensions

I came across this brilliant cheat sheet for picking a visualisation for you data: ExtremePresentation – Choosing a Good Chart. Of course these are static visualisations, but the same principals would hold for interactive visualisation.

What I find interesting, is that there is only one example of a 3D visualisation and it is associated with a very specific use case – the relationships between three variables. In some areas (BI dashboards, marketing presentations etc.) there is a trend towards 3D plotting and visual eye candy. Sometimes though, it just clutters the information or even worse it obscures the message. I wonder if simply having 3 individual 2D charts side-by-side wouldn’t do the same job and present the relationships better.

Here is a very quick example using R. Let’s create a series of 3-dimensional points:

library(ggplot2)
library(scatterplot3d)
library(gridExtra)

data <- data.frame( xs <- runif(100, 0, 40) )
data$ys <- log(data$xs * 2 * runif(100, 0, 5))
data$zs <- (1/3) * data$xs**2 + (3/5)*data$ys + 5

Clearly this data is 3 dimensional and it would make sense to plot the data in 3 dimensions:

scatterplot3d(x=data$xs, y=data$ys, data$zs)
Visualising data in 3D can be impressive but is it informative?

Visualising data in 3D can be impressive but is it informative?

But what we find, is that it is very difficult for us to observe the relationships between the 3 dimensions. We have actually obscured a lot of information here. Sure, there is a general upward trend, but how tightly does each dimension correlate to another?

Far better to plot the relationships side-by-side:

pxy <- ggplot(data, aes(x=xs, y=ys)) + geom_point() + geom_smooth()
pxz <- ggplot(data, aes(x=xs, y=zs)) + geom_point() + geom_smooth()
pyz <- ggplot(data, aes(x=ys, y=zs)) + geom_point() + geom_smooth()

grid.arrange(pxy, pxz, pyz, nrow=1)
Using side-by-side plots can illustrate relationships better than a single 3D plot

Using side-by-side plots can illustrate relationships better than a single 3D plot

With side-by-side plots like this we can instantly see that there is a very tight correlation between the x and z dimensions and a looser correlation to the y dimension. In terms of exploration and analysis, this is perhaps a more informative way to visualise this data.

This might all seem quite obvious… but you’d be surprised. Go and check out EagerEyes, EagerPies and WTFViz for some entertaining examples of visualisations gone horribly wrong!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: