Archive

Posts Tagged ‘homicide rate’

Intentional Homicide in South America 1995-2010

February 9, 2012 11 comments

Intentional homicide is defined as unlawful death purposefully inflicted on a person by another person. The source of this stat is The United Nations Office on Drugs and Crime (UNODC).

I created the above image using ggplot2 which does 98% of the leg-work in most cases. Count is the number of homicides in a calendar year and homicide rate per 100.000 population.

Then with a litttle of Adobe Illustrator the final datavis looks like this:

 

require(XLConnect)
library(reshape)
library(ggplot2)
homicides <- wb["Sheet1"]
colnames(homicides) <- c("country","stat",seq(from=1995,to=2010))
h.count[,-2]
s <- melt(homicides,id.vars=c('country','stat'))
s <- subset(s, value!=-1)
s2 <- as.data.frame(cast(s,country+variable~stat))

midpoint <- mean(range(na.omit(s2$Rate)))

p <- ggplot(s2,aes(x=variable,y=country)) +geom_point(aes(size=Count,color=Rate))
p <- p+ scale_size(to = c(3, 10)) + scale_color_gradient2(low='darkgreen',mid="yellow", high="red",midpoint=midpoint)
p <- p+theme_bw()
p <- p+opts(panel.grid.major=theme_blank(),panel.grid.minor=theme_blank())
p
%d bloggers like this: