architects,bigdata,theory,tools & methods,big data

# Visualizing Multidimensional Data in Two Dimensions

Recently I ran into an issue where I had multidimensional data and didn't have an effective way to visualize it. Those who are less visual and more abstract are content to explore multidimensional data mathematically. If you're like me however you're visual and you want to see the shape of your data.

Enter star coordinates.

What are they? Here's my quick explanation then I'll direct you to the paper that taught me about them. Say you have a three dimensional point (3, 4, 5). You would go a distance of three along what you would normally call the x-axis. Next, and here is where it gets more interesting, pretend you're the point and turn (2 * pi) / dimension_count (three in this case) and then walk 4 units in this direction. Turn again and walk 5 units.

Read more about Star Coordinates here: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.8909

So theory is always great but here's how I implemented it and what my version looks like when graphing 4 dimensions.

The first thing I worked on was plotting a single point. I ended up with this solution:

var draw_point = function(ctx, origin_pixel, scale, row){ var axial_rotation = (2 * Math.PI)/row.length; var final_point = {x:0, y:0}; for(var i in row){ final_point.x += scale[i] * row[i] * Math.cos(i * axial_rotation); final_point.y -= scale[i] * row[i] * Math.sin(i * axial_rotation); } ctx.fillRect(origin_pixel.x + final_point.x, origin_pixel.y + final_point.y, 2, 2); };

Two things are involved, using some trigonometry to figure out how to move along the x and y axes for each dimension and aggregating them into a single point. You'll see in the code I have something I call "axial_rotation" that's how much I need to rotate as I step through each dimension of the point.

I didn't end up finding anything worth while in my data but maybe this technique will help me in the future... or maybe even help you.

I'm not 100% certain it's perfect. If anyone happens upon this and finds an error I'd love to know about it.

Published at DZone with permission of {{ articles[0].authors[0].realName }}, DZone MVB. (source)

Opinions expressed by DZone contributors are their own.

{{ nComments() }}