Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an array of dimension 5. But, I can't figure out how to visualize that array?

int[][][][][] array = new int[4][4][4][6][2].

Is there a good way to visualize arrays with dimension counts of 3 or more?

share|improve this question

closed as not a real question by Steven A. Lowe, Walter, Dynamic, World Engineer, gnat Dec 23 '12 at 20:37

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

What does the array represent? – msell Dec 23 '12 at 7:10
Why do you need a 5-D array? What is the specific purpose? – user75785 Dec 23 '12 at 7:12
Have you considered 3D cube + 2 sliders to control the other 2 dimensions? Or an 'animation' that scrolls through one of the dimensions? This is standard technique for visualizing 4D objects (like the Tesseract) – K.Steff Dec 23 '12 at 10:40
+1 to what does the array represent. Reconsider whether you really have 5d data or a more complex object hierarchy that would be better represented by a 3d array of, say, 2d objects. A proper object model would help you reason about how to best visualize it. – scrwtp Dec 23 '12 at 11:44

A 2d array of 3d cubes would visualize it, although there's no good general way to show all the data at once in any meaningful way.

share|improve this answer

I don't think it makes sense to visualize array in any sort of real 'spatial' sense. Ultimately, it's all getting mapped to 'flat' memory addresses.

If you really had to do it - maybe something like this?

5d (

Still, I'd just avoid trying to think of it as anything physical. Because....well, it isn't.

If you think of it as an array of arrays (...of arrays...) you can describe any nd array.

enter image description here

A two dimensional array is just an array where each element represent it's own array.
A three dimensional array is just an array where each element represent an array where each element represents an array. etc...etc...

share|improve this answer

"Visualizing" beyond 3 dimensions is very difficult, if not impossible to do spatially (although I have friends who swear they can do 4). But if you want a good idea of how to think of a 5d or even n-d matrix represents data, think of an html source tree. You have:

top layer[0]
    stuff in the second layer[0][0]
        stuff in the third layer[0][0][0]
             you get the picture...
        stuff in the third layer[0][0][1]
    stuff in the second layer[0][1]
top layer[1]
    more stuff...
share|improve this answer

Think of each level of multi-D array access as an address with meaning that leads to something specific.


This could represent whatever's at the space coords x-0, y-1, z-7.

But nobody said it had to be spatial. It could also be what you get when you select choice 0 on the first menu, 1 on the second menu and 7 on the next.

Multi-D arrays are ultimately simply about using arrays to create chained numeric mappings to specific values. In the end it's always only the last array in the chain that actually holds values rather than arrays. The indeces can have any meaning we want to give them.

share|improve this answer

If you look for a graphical way to represent it in a 3D space what @whatsisname said is the solution. Or the other way around: a cube in which each element is a matrix. It depends on what your data represents.

If you just want to check the data, an expandable 5-level tree should do just fine.

share|improve this answer

That really depends on the content of cells. But if you really want to visualize the content, you don't need to see at once 5D array of high precision values.

Define few (2-5) efficiently different ranges to where could belong values. And make 2 of your dimensions as x and y, and other three - interpret as colors - R,G,B. And in every point (x,y,r,g,b) you can have a value of the range. Of course, a looker needs time to understand the image, but he would need it for every sort of 5D image.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.