[R] Bumps chart in R

Andreas Christoffersen achristoffersen at gmail.com
Mon Apr 27 00:45:23 CEST 2009


Hi there,

I would like to make a 'bumps chart' like the ones described e.g.
here: http://junkcharts.typepad.com/junk_charts/bumps_chart/

Purpose: I'd like to plot the proportion of people in select countries
living for less then one USD pr day in 1994 and 2004 respectively. I
have already constructed a barplot - but I think a bumps chart would
be better

# The barplot and data
countries <- c("U-lande", "Afrika syd for sahara", "Europa og
Centralasien", "Lantinamerika og Caribien","Mellemøstenog Nordafrika",
"Sydasien","ØStasien og stillehaveet", "Kina", "Brasilien")
poor_1990 <- c(28.7,46.7,0.5,10.2,2.3,43,29.8,33,14)
poor_2004 <- c(18.1,41.1,0.9,8.6,1.5,30.8,9.1,9.9,7.5)
poor <- cbind(poor_1990,poor_2004)
rownames(poor) <- countries
oldpar <- par(no.readonly=T)
par <- par(mar=c(15,5,5,1))
png("poor.png")
par <- par(mar=c(15,5,5,1))
barplot(t(poor[order(poor[,2]),]),beside=T,col=c(1,2),las=3,ylab="%
poor",main="Percent living for < 1 USD per day (1993
prices)",ylim=c(0,50))
legend("topleft",c("1990","2004"),fill=c(1,2),bty="n")
par(oldpar)
dev.off()

I Guess I need to start with an normal plot? Something like the below
- but there is a loong way to go...

# A meager start - how to finish my bumps chart
plot(c(rep(1,9),rep(2,9)),c(fattig_1990,fattig_2004),type="b",ann=F)

Thankfull for any help.

Cheers.

Andreas




More information about the R-help mailing list