There are several techniques to show the distribution of two variables in the same time (2D distribution). The idea is to count the number of observation within a particular area of the 2D space and represent this count by a color. We can apply this method to map.

 

Here I consider a list of GPS coordinates. I harvested 200k tweets talking about #surf and geo-localized them. I split the globe in several squares, count the number of tweet per square, and attribute a corresponding color to the square. In the background I add the shape of the world to be sure to understand where I am. Let’s do it!

This is what I would call a 2D histogram map. We can try to do the same using a 2D density, once more ggplot2 is our best friend to easily go from one geom to another (Europe only):

Hmm, this is a bit disappoint but I left the example because it could work better on another dataset. Let’s make a last version with a hexbin map:

Not too bad, but I realise I could have done better with the color scale using binning.. I will be back!

 

Related



Leave a Reply

Be the First to Comment!

avatar
  Subscribe  
Notify of