Tuesday, March 21, 2017

3D graphs

In this post I am going to discuss 3 dimensional graphs. By 3D graphs I mean representation of a 3 dimensional data (3 variables). You have probably seen graphs when 3D effects were applied to 2 dimensional data. I cannot stress that enough - this is bad practice. Adding this extra dimension does not add anything to your graph and in fact can have dramatic effects on its readability. So again "No 3D effects on 2D data".
Back to the topic: visualizing 3 variables can be done in many ways, but your first thought was probably to "simply" make a 3D graph with x,y and z axis, like this example from Feliciano et al. 2017:



In the next paragraphs I will try to convince you to refrain from making graphs like this and later show some alternatives.

First of all, reading values from such graphs is really difficult. As a matter of fact, all you can see in the example is that there is a cloud of high values of coefficient of adaptation corresponding to fast spiking neurons. But can you draw the similar (or opposite) conclusion about the other two values? Even if you were to draw the lines between single points and each plane you will have difficulty getting the right value. This is because this graph is shown in perspective meaning that lines are not parallel, but converge to the abstract point in the horizon.

Secondly, let's say you are not interested in exact values, you just want to compare them. Can you do that? Let's say do the green and purple dots have the same coefficient of adaptation? PPR value?




All of this is because we are really bad at extracting 3D information from 2D images. You can read more about it in papers from Pierre Dragicevic and Yvonne Jansen and afore mentioned Margaret Livingstone. Dragicevic/Jansen particularly focus on 3D data perception and come to a conclusion that 3D data works best when presented as such - printed, allowing you to touch it and adjusting the angles of your vision. Let's be honest, even though very appealing, it's hard to imagine a little graph sculpture attached to a your publication...










Cortisol data scuplture


Alternatively, you can allow your reader to render 3D graph on screen which will significantly affect its readability.

Lastly, making a 3D graph is quite a challenge (especially of you want your reader to be able to render it), as it requires a bit of coding skills . Excel, does not allow to make them, neither does GraphPad or Tableau (happy to be corrected, but I couldn't find a solution). Overall, it seems like a lot of hustle for very little gain...

So what are your alternatives when it comes to presenting data of three values in a single graph?

Option_1

2 values represented as scatter plot (values encoded in position), 3rd value represented as size of the point (bubble plot). This would look as follows:

Please note that even though I chose to label the axes the same as in the original graph from Feliciano et al. the values do not correspond to that graph (as I said I cannot extract them easily from a graph), so the graph was generated from random values.

This graph is clearly an improvement from original, but you may still ask yourself is it really so much easier to read the values of spiking frequency, encoded in size of the points? The answer is not necessarily. You can probably spot really big ones and really small values, but it becomes more tricky in the mid range. Graph like this gives you an estimate of the values and you should be able to spot a pattern (assuming there is one - remember I used randomly generated data!).

If you would like to see exact values you can also print them on the graph, but you risk getting a very cluttered graph.

Option_2

2 values represented as scatter plot (values encoded in position), 3rd value represented as lightness of the color of the point. This would look as follows:

This looks much better, right? End even though it is still not the easiest to read the exact values you can compare the points much easier than with the area encoding.

As I mentioned at the beginning, 3D graphs are not easy to make and will require from you to step down from Excel. To generate the makeovers I used Tableau Public. This proved to be the easiest solution, so I would highly recommend trying it out. You just have to be aware that using the free version of Tableau means your data becomes publicly available.