Great circles: level up with R

It’s been four years since I was inspired by Paul Butler’s well-known Facebook network map made with R to make some of my own. Brushing off the dust from these grad school days plots, and recalling memories of a time when I still solved math problems with a pencil and R still put the fear in me on a daily basis despite holding out great promise, I’ve decided it’s time to revisit these and spiff them up a bit.

BlkGrnYelWht1_crop_resample

At the time there was much talk about it being surprising that such cool graphics could be made with so few lines of code. Back then I was still fairly new to R myself, so I was among the surprised. Several years later, I am surprised there was such surprise. At this point R is like a paintbrush to me. I have data. I want to visualize it. It’s a matter of telling R to color pixels. Of course, that’s a gross simplification. The point is that it’s really good at what it can do. Over time, I’ve simply gotten better at telling it to do things.

It really doesn’t take a lot of code to make great R graphics. In a case like this, you can do it in base graphics, lattice, ggplot2, whatever you wish. (I use base graphics when I want to get very particular and exercise fine-grained control, but that’s just my preference.). It’s just lines, and more lines, and maybe some points for good measure. Altering color and/or opacity by attributes of your data goes a long way to making it look more impressive – and that takes almost no code at all!

What plots like this generally do require to look nifty are the right data, and lots of it, (or you can simulate your own like I did in my originals if you don’t have any), not to mention in the right format for what you are trying to achieve. But that’s not a novel notion. Data prep is often the biggest hurdle. Depending on how extreme you want to go, processing power helps as well.

This brings me to the part about leveling up. When I made my first network maps with great circles, my code was a bit of a rat’s nest and not the most efficient (though still not a large amount of code overall). Looking at it again years later, I can now entertain creative visualization ideas I had back then which I shelved for having been ahead of my creativity regarding implementation, not just in terms of my graphics-related code but also coding to efficiently utilize the computing resources I had access to.

A few static 3D examples have already been posted, but these initial attempts were very limited, not nearly versions of the above, though I am getting closer. In upcoming posts I will share some preliminary examples of three-dimensional versions of these geographic network graphs, animated graphs, and the combination of the two. As usual, there is not enough time in the day to get all my ideas down in code, but there are some cool things on the horizon that will be exciting to share.

This entry was posted by Matt Leonawicz.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: