[R] histbackback for population pyramid

Camarda, Carlo Giovanni Camarda at demogr.mpg.de
Thu Apr 22 11:37:44 CEST 2004


Hi R-people,
I hope someone could help me. I have to draw a population pyramid, but using
histbackback (in Hmisc library) function I've got just histograms of density
or frequency of my distribution. How can I get a population pyramid without
playing on barplot function? I give a simple example that, solved, would
help me.

# dataset
x1 <- c(100, 80, 60, 40, 20, 10)
x2 <- c(95, 85, 65, 45, 15, 5)
x3 <- -x2

# a too simple pyramid with barplots (I could use other options for possible
improvements)
par(mfrow=c(1,2))
barplot(x3, horiz=TRUE)
barplot(x1, horiz=TRUE)

# what I could get from histbackback function
library(Hmisc)
par(mfrow=c(1,1))
histbackback(x1, x2, xlab=c("males", "females"))

Thanks in advance, Giancarlo




+++++
This mail has been sent through the MPI for Demographic Rese...{{dropped}}




More information about the R-help mailing list