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.


# 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"),

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")

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>