# What are some popular choices for visualizing 4-dimensional data?

Say I have the following four dimensional data, where first three can be considered as coordinates, and the last one can be considered as values.

c1, c2, c3, value
1, 2, 6, 0.456
34, 34, 12 0.27
12, 1, 66 0.95


How to better visualize the effect of the first three coordinates on the last value?

I're aware of three methods.

One is 3D plot for the first three coordinates with the size of points as the four value. But it is not that easy to see the trend in the data.

Another is using a series of 3D plot, each of which is with a coordinate fixed.

Another one may be a socalled "trellis graphs" in lattice of R. Not sur eif it is for this purpose but it seems so.

• Do you need a static display (eg, for a paper)? Nov 18, 2014 at 22:05

If the first three are just spatial coordinates and the data are sparse you can simply do a 3D scatter plot with differently sized or colored points for the value.

Looks something like this:
(source: gatech.edu)

If your data is intended to be continuous in nature and exists on a lattice grid, you can plot several isocontours of the data using Marching Cubes.

Another approach when you have dense 4D data is to display several 2D "slices" of the data embedded in 3D. It will look something like this:

• The colored 3D scatterplot is only really suitable for continuous functions on 3D data. If the gradient of the function changes smoothly then you can see some pattern across the point scatter. Similarly the volume visualization at bottom works best in this scenario too. If the function is very noisy you will have a hard time seeing anything. If you have 4 explanatory variables (like for doing PCA or clustering) plotting 3 in Euclidean coordinates and the 4th using some nonlinear mapping to color in introducing some perceptual bias, which can't be quantified. Nov 20, 2014 at 13:46
• @DianneCook that's true. I guess that's what I get for always working with smooth, continuous 3D volumetric data ;) Nov 20, 2014 at 17:47
• Hey, that's what the quesiton asked %^) Nov 22, 2014 at 1:32

Do you have four quantitative variables? If so, try tours, parallel coordinate plots, scatterplot matrices. The tourr (and tourrGui) package in R will run tours, basically rotation in high dimensions, you can choose to project into 1D, 2D or more, and there is a JSS paper that you can read to get started cited in the package. Parallel coordinate plots and scatterplot matrices are in the GGally package, also scatterplot matrices are in the YaleToolkit package. You can also look at the http://www.ggobi.org for videos and more documentation on all of these.

If your data is entirely categorical you should use mosaic plots, or variants. Take a look at the productplots package in R, also vcd has some reasonable functions, or the ggparallel package to do the equivalent of parallel coordinate plots for categorical data. Also, just found the extracat package has some functions for displaying categorical data.

I misread the question, originally, because I stopped at the question, and neglected to read the full description. Similar to the approach below (coloring points in 3D) you can use linked brushing to explore functions defined on high-dimensional spaces. Take a look at the video here which shows doing this for a 3D multivariate normal function. The brush paints points with high density (high function values) and then moves to lower and lower density values (low function values). The locations where the function is sampled are shown in a 3D rotating scatterplot, using the tour, which could be used to look at 4, 5, or higher dimensional domains also.

Try Chernoff faces. The idea is to attach the variables to facial features. For instance, size of the smile would one variable, roundness of the face is another etc. As ridiculous as it sounds, this may actually work if you find out a smart way to map variables to features.

Another way is to show 2-d projections of the 3-d phase diagram. Say you have x1,x2,x3,x4 your variables. For each value of x4, draw 3-d graph of (x1,x2,x3) points, and connect the points. This works best when x4 is ordered, e.g. it's date or time.

UPDATE: You can also try bubble plots. Three dimensions would usual cartesian x,y,z, and the 4th dimension would the size of the bubble point.

You can try animation, i.e. use time as fourth dimension.

Also a combination of bubble and animation: x,y, bubble and time.

Also, related to Chernoff is glyph plot, which may look a little more serious. It's stars with length of rays proportional to variable values.

• Thank you for the answer. It seems the second option is possible to my problem. I think the first one seems not that serious for a research paper. Basically I would like the plot can reveal some trend or influence of three factors on the value (fourth dimension). Nov 13, 2014 at 15:19
• Chernoff faces were used in serious research, afaik. Nov 13, 2014 at 15:24
• Chernoff faces can be extraordinarily useful, especially when the dimensionality is around 10-20 variables. For four dimensions they aren't as effective as other kinds of graphical representations.
– whuber
Nov 13, 2014 at 15:51
• chernoff faces are a terrible idea! if you have to use an icon plot use a starplot. If you have a really small data set these might be useful, but try plotting 1000 icons and see if you can really see anything! Nov 18, 2014 at 22:00