On looking beyond two dimensions

Too many bad 2.5D pie charts have lead people to discard 3D data visualization out of hand. As we push data and analytics further out into our complex world, the third dimension will need be promoted from flash to function. For example, data viz darlings the New York Times have developed Cascade, a 3D visualization helping journalists tackle the complex space of Twitter. We believe that such careful, measured applications of 3D are needed to replace the careless exuberance of the past.

Over the next decade, emerging technologies and trends, such as the Internet of Things, will cause the global information sphere, which is not just the internet but is largely the internet, to come crashing headlong into our physical reality. As this happens, we will need to visualize data in our newly augmented reality, a reality that is undeniably three dimensional.

Today, a fairly technical example of what you could be missing when you only see your data in two dimensions.

Three Dimensions

Consider an X, Y, and Z viewed in a traditional bivariate scatter matrix.

1_pairs

Zero correlation, though the data does form a suspicious circle shape. We can hypothesize that the data forms a sphere, but it is not until we look at it that we see that we have missed something drastic.

movie1

movie2

We could have seen this in a 2D plot if we had encoded the third dimension, Z, to point brightness.

scatter_1

But what to do with four dimensions?

Four Dimensions

Consider an X, Y, Z, and A as below.

2_pairs

Zero correlation, though the data does form a suspicious circle shape. We can hypothesize that the data forms a hypersphere. If we look at it in 3D, say X, Y, and Z together, it looks like an innocent sphere.

movie3

If we look at it in 2D with the third dimension as point brightness as before, again nothing suspicious.

scatter_2

We cannot see the pattern until we look at it in 4-dimensions. X, Y, Z, and A tied to point brightness:

movie7

movie8

Two Dimensions

This is not tremendously different from examples that compel us to look at our data in 2-dimensions rather than not at all.

X and Y with zero correlation:

plot_1hist_5

And don’t forget Anscombe’s quartet

quartet

In Summary

If you don’t look at your data it can deceive you. That was true in two dimensions and is true above. If we live in a world of bivariate visualization we will miss important complex patterns because we are not looking for them. The third dimension must be considered when using visualization in analysis just as it must be rejected as a means to jazz up uninspiring pie charts.

R Code

x = c()
y = c()
z = c()

for(i in 1:5000)
{
  keep = FALSE
  while(!keep)
  {
    newX = runif(1,-1,1)
    newY = runif(1,-1,1)
    newZ = runif(1,-1,1)

    inSphere = ((newX^2)+(newY^2)+(newZ^2))<=1
    inPiece1 = ((newX>0)&(newY>0)&(newZ>0))
    inPiece2 = ((newX<0)&(newY<0)&(newZ>0))
    inPiece3 = ((newX<0)&(newY>0)&(newZ<0))
    inPiece4 = ((newX>0)&(newY<0)&(newZ<0))
    inAPiece = inPiece1|inPiece2|inPiece3|inPiece4
    keep = inSphere & inAPiece
  }

  x = append(x,newX)
  y = append(y,newY)
  z = append(z,newZ)
}

pairs(~x+y+z)
cor(x,y)
cor(y,z)
cor(x,z)

library(rgl)
plot3d(x,y,z)

library(Rcmdr)
scatter3d(x,y,z)

plot(x~y,col=hcl(0,10,(z+1)*50))

x = c()
y = c()
z = c()
a = c()

for(i in 1:5000)
{
  keep = FALSE
  while(!keep)
  {
    newX = runif(1,-1,1)
    newY = runif(1,-1,1)
    newZ = runif(1,-1,1)
    newA = runif(1,-1,1)

    inSphere = ((newX^2)+(newY^2)+(newZ^2)+(newA^2))<=1

    inPiece1 = ((newX>0)&(newY>0)&(newZ>0)&(newA>0))
    inPiece2 = ((newX<0)&(newY<0)&(newZ>0)&(newA>0))
    inPiece3 = ((newX<0)&(newY>0)&(newZ<0)&(newA>0))
    inPiece4 = ((newX<0)&(newY>0)&(newZ>0)&(newA<0))
    inPiece5 = ((newX>0)&(newY<0)&(newZ<0)&(newA>0))
    inPiece6 = ((newX>0)&(newY<0)&(newZ>0)&(newA<0))
    inPiece7 = ((newX>0)&(newY>0)&(newZ<0)&(newA<0))
    inPiece8 = ((newX<0)&(newY<0)&(newZ<0)&(newA<0))

    inAPiece = inPiece1|inPiece2|inPiece3|inPiece4|inPiece5|inPiece6|inPiece7|inPiece8

    keep = inSphere & inAPiece

  }

  x = append(x,newX)
  y = append(y,newY)
  z = append(z,newZ)
  a = append(a,newA)
}

pairs(~x+y+z+a)
plot(x~y,col=hcl(0,10,(z+1)*50))
library(rgl)
plot3d(x,y,z)
plot3d(x,y,z,col=hcl(0,10,(a+1)*50))

Created by Pretty R at inside-R.org


SHARE :

(1) Comment

[…] I’ve just written a post over at the NGRAIN blog, On looking beyond two dimensions. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>