Visualing High Dimensions as DNA Strands

January 10, 2016

(This article was first published on You Know, and kindly contributed to R-bloggers)

For a community project, I needed to research which U.S. cities were most similar to mine. The U.S. census has some wonderful data that covers 1,579 statistical areas, using the Office of Management & Budget’s definition.

With this data, I selected the relevant attributes and then calculated the root mean squared error of the scaled distances from the target city as a (dis)similarity metric. After sorting the results, I could identify the ten most similar cities.

But there was a catch… I was to share my findings in a presentation and raw statistics aren’t always conducive to making engaging slide shows. Displaying two dimensions is straightforward, maybe even three or four are doable. My analysis had forty-plus dimensions. My approach was to think of each attribute as a point in a DNA strand. When you are finished, each little twist and turn represents another data point. Up or down ticks don’t matter, they just show the shape of the city in data-vision. FYI, all images were created using the ggplot2 package in R.

Start with a graph of each (scaled) point plotted.

Next, remove the grid lines.

Connect the dots.

Display all of the other cities’ strands.

Subset to the ten cities most similar to yours.

In your presentation software, just set the animation or action to show each image in succession. I could tell that the audience was able to comprehend the message of how I discovered the ten most similar cities to ours. Thought I would share this little technique in case you face a similar challenge. By the way, if anyone has seen this concept before I would love to know how it has been used elsewhere.

Visualized as a layered animation

To leave a comment for the author, please follow the link and comment on their blog: You Know. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)