Baboon Distribution Map

My good friend Kenny Chiou (previously) has maps of baboon distributions available over at his Monkey Matters Blog. I’m planning on stealing them (with attribution) for future conference publications. Anyone else who studies genus Papio should do the same.

Here is his map for the anubis and hamadryas baboons, the subjects of my thesis:

Looks sharp!

Citizens Climate Lobby Map

Here’s yet another quick R map. Shown below are the locations of chapters of the Citizens Climate Lobby, a group of normal folk who campaign for a carbon tax in the U.S. and Canada:

Click for larger version. Here’s the code used to make the three layers (color, black and white, and the gradient) which I put together with basic Photoshop magic:

library(ggmap)

chapters = read.table("CCLchapters.txt", sep="\t", header=TRUE)

map.center = geocode("Utah")

######################################
# Just Points in B&W
pdf(file="bw.pdf")

map.base = get_googlemap(
	as.matrix(map.center),
	maptype = "terrain",
	zoom = 3,
	color = "bw",
	scale = 2)
map.ggmap = ggmap(map.base, extent = "device")

map.ggmap + 
	geom_point(aes(x=lon, y=lat), data=chapters, shape=1, size=5, alpha=.2) + 
	geom_point(aes(x=lon, y=lat), data=chapters, shape=19, size=2)

dev.off()

######################################
# Just density contour plot
pdf(file="density.pdf")

ggmap(get_map(location=as.matrix(map.center), zoom = 3, scale = 2), 
		darken=c(1, 'white'), extent = "device") +
	stat_density2d(aes(x = lon, 
                       y = lat, 
                       fill = ..level.., 
                       alpha = ..level..),
                   size = 0.01, 
                   bins = 50,
                   data = chapters, 
                   geom = "polygon") +
	scale_fill_gradient(low="darkgrey", high="black") +
	theme(legend.position="none")

dev.off()

######################################
# Just Points in Color
pdf(file="color.pdf")

map.base = get_googlemap(
    as.matrix(map.center),
    maptype = "terrain",
    zoom = 3,
    color = "color",
    scale = 2)
map.ggmap = ggmap(map.base, extent = "device")

map.ggmap + 
	geom_point(aes(x=lon, y=lat), data=chapters, shape=1, size=5, alpha=.2) + 
	geom_point(aes(x=lon, y=lat), data=chapters, shape=19, size=2)

dev.off()

Edit: Thanks to meren for pointing out via the comments that I didn’t make CCLchapters.txt available. Here it is if you care to download it. Happily, the Citizens Climate Lobby has grown and increased the number of nationwide chapters since I wrote this original post, but it means the file is now obsolete!

Map: Where Primate Pets are Legal

Inspired by the sad story of Darwin, known as the “Ikea monkey,” I made this map of state laws regulating the keeping of non-human primates as pets. The data comes from this article in the International Business Times by Roxanne Palmer. The R code to generate the map is below.


library(maps)

# Load pet law data
pet_data = read.table("pet_data.txt", header=FALSE)
names(pet_data) = c("state", "status")

# Translate statuses into colors
col = rep("grey", length(pet_data$status))

color.meanings = data.frame(
	state=c("Illegal", "Legal but effectively banned", 
			"Some species legal", "Legal with permit", "Legal"),
	color=c("#006837","#1A9850","#FDAE61","#F46D43","#D73027"))

for (i in 1:nrow(color.meanings)) {
	this.state = as.character(color.meanings[i,]$state)
	this.color = as.character(color.meanings[i,]$color)
	
	col[pet_data$status == this.state] = this.color
}

# Plot map
out = map("state", interior = FALSE)
int = map("state", boundary = FALSE, col=col, add = TRUE, fill=TRUE)

# Add legend and title
legend("bottomleft", legend = color.meanings$state, 
	col = as.vector(color.meanings$color),
	ncol = 1, cex = .65, lwd = 8, seg.len = 1)
title("Legality of Keeping Primates as Pets")