[R] Creating the Firefox Download Analytics Map in R

Jason Rupert jasonkrupert at yahoo.com
Wed May 26 04:16:43 CEST 2010


The below is starting to get close to the Firefox Download Analytics Map, but I've still got a bit to go.  Any insights or feedback about ways to improve the code below to more closely resemble the Firefox Download plot are greatly appreciated.  Specifically, I would like to improve the presentation of the countries, i.e. removing Antarctica.   

(1) I posted the input data and the current plot to the following location:
http://stuff.2489251.n2.nabble.com/Trying-to-produce-the-Firefox-Download-Figure-td5101428.html#a5101428

(2) Below is the code I've come up with so far:


library(sp)
library(Hmisc)
library(maptools)

shp <- readShapeSpatial('32752')

colors <- c("lightsteelblue3","deepskyblue3","darkblue", "goldenrod1","darkorange2","firebrick4")

cuts <- c(1000, 5000, 10000,  50000, 100000, 500000)

write.csv(shp$CNTRY_NAME, 'WorldShapeFileListings.csv')


world_data <- read.csv('WorldData2010.csv')

world_data$Col <- as.integer(cut2(world_data$Downloads,cuts=cuts))


shpA <- shp[match(world_data$place, shp$CNTRY_NAME),]

png("WorldMap2010.png", width=620, height=400)
plot(shpA, col=colors[world_data$Col], border=gray(.85))

legend("bottomleft",legend=c("1K",
                             "5K",
                             "10K",
                             "50K",
                             "100K",
                             "500K+"), fill=colors, title="Total Downloads")

title("Firefox Downloads")

dev.off()





----- Original Message ----
From: Jason Rupert <jasonkrupert at yahoo.com>
To: R Project Help <R-help at r-project.org>
Sent: Fri, May 21, 2010 7:55:07 PM
Subject: [R] Creating the Firefox Download Analytics Map in R

By any chance has anyone put together the R code for reproducing the Firefox Downloads Analytics Map in R? 

Here is a link to an example: 
http://www.knitwareblog.com/wp-content/uploads/2008/06/firefox-3-download-map.jpg

I'll try to track down the inputs, but I am interested in putting the code to produce this or something similar. 

Any hints about the best packages, or references to R Blog posts that may discuss the code necessary to produce this or a similar plot is very much appreciated.  

Thanks again for all the insights and feedback.

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list