[R] Population pyramids

Victor Manuel Garcia Guerrero vmgarcia at colmex.mx
Fri Jul 10 06:20:58 CEST 2009


Wonderful!!! It works!!! Thank you very much Daniel. I owe you one.
 
Cheers
 
Victor

________________________________

De: Daniel Malter [mailto:daniel at umd.edu]
Enviado el: jue 09/07/2009 10:44
Para: Victor Manuel Garcia Guerrero; r-help at r-project.org
Asunto: AW: [R] Population pyramids




Victor, use the axes=FALSE option, as you do. Then use the "labels" and "at"
options in the "axis" argument to place the tickmark labels in the negative
plot manually


par(mfrow=c(1,2),bty="n",mai=c(0.5, 0.25, 0.25, 0.25))

x=rgamma(1000,10,0.3)

barplot(height=t(-x), width = 0.825, space = NULL,
        names.arg = NULL, legend.text = c("Inf 95%","Mediana","Sup 95%"),
        beside = FALSE,
        horiz = TRUE, density = NULL, angle = 0,
        axes = FALSE,
        col = c("yellow","Blue","orange"), border = par("fg"),
        main = "Mujeres",
        xlim =NULL, ylim = NULL, xpd = TRUE, log = "",
        axisnames = FALSE,

axis(1,hadj=NA,padj=NA,cex.axis=0.75,labels=c("0","10","20","30","40","50","
60","70"),at=c(0,-10,-20,-30,-40,-50,-60,-70)))


barplot(height=t(x), width = 0.825, space = NULL,
        names.arg = NULL, legend.text = c("Inf 95%","Mediana","Sup 95%"),
        beside = FALSE,
        axes=FALSE,
        horiz = TRUE, density = NULL, angle = 0,
        col = c("yellow","Blue","orange"), border = par("fg"),
        main = "Mujeres",
        xlim =NULL, ylim = NULL, xpd = TRUE, log = "",
        axisnames = FALSE,
        axis(1,cex.axis=0.75))

That should do. Best,
Daniel       


-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: Victor Manuel Garcia Guerrero [mailto:vmgarcia at colmex.mx]
Gesendet: Thursday, July 09, 2009 1:44 AM
An: Daniel Malter; r-help at r-project.org
Betreff: RE: [R] Population pyramids

Yes the code is the next:

par(mfrow=c(1,2),bty="n",mai=c(0.5, 0.25, 0.25, 0.25))

barplot(height=t(icNM2005.dat), width = 0.825, space = NULL,
        names.arg = NULL, legend.text = NULL, beside = FALSE,
        horiz = TRUE, density = NULL, angle = 0,
        col = c("yellow","Blue","orange"), border = par("fg"),
        main = "Hombres",
        xlim =NULL, ylim = NULL, xpd = TRUE, log = "",
        axes = FALSE, axisnames = FALSE,cex.axis=0.75)
        axis(1,pretty(c(-1200,0),n=12),
        hadj=NA,padj=NA,cex.axis=0.75,las=2)


barplot(height=t(icNF2005.dat), width = 0.825, space = NULL,
        names.arg = NULL, legend.text = c("Inf 95%","Mediana","Sup 95%"),
        beside = FALSE,
        horiz = TRUE, density = NULL, angle = 0,
        col = c("yellow","Blue","orange"), border = par("fg"),
        main = "Mujeres",
        xlim =NULL, ylim = NULL, xpd = TRUE, log = "",
        axes = FALSE, axisnames = FALSE,cex.axis=0.75)
        axis(2,pretty(c(0:105),n=21),hadj=0.5,padj=0.5,cex.axis=0.75,
        las=2)
        axis(1,pretty(c(0:1200),n=5),
        hadj=NA,padj=NA,cex.axis=0.5,las=1)
       

Víctor Manuel García Guerrero
Doctorado en Estudios de Población,
CEDUA, COLMEX
Camino al Ajusco N° 20, Pedregal de Sta. Teresa C.P.10740, Tlalpan, México,
D.F.
* : vmgarcia at colmex.mx
( : 5617-9016



-----Mensaje original-----
De: Daniel Malter [mailto:daniel at umd.edu] Enviado el: jue 09/07/2009 12:15
Para: Victor Manuel Garcia Guerrero; r-help at r-project.org
Asunto: AW: [R] Population pyramids

Can you provide a self-contained example of what you did so far (i.e. code
for simulating some data and code for the plot)? That would greatly help to
help you find a solution.

Daniel


-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: Victor Manuel Garcia Guerrero [mailto:vmgarcia at colmex.mx]
Gesendet: Thursday, July 09, 2009 12:48 AM
An: Daniel Malter; r-help at r-project.org
Betreff: RE: [R] Population pyramids

Yes, but my issue is because I need to plot a pop pyramid with confidence
intervals, and the pyramid function does not work in that way. Thanks
Daniel.


-----Mensaje original-----
De: Daniel Malter [mailto:daniel at umd.edu] Enviado el: mié 08/07/2009 11:36
Para: Victor Manuel Garcia Guerrero; r-help at r-project.org
Asunto: AW: [R] Population pyramids

have you tried the pyramid function in the epicalc package?

best,
daniel


-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Victor Manuel Garcia Guerrero
Gesendet: Thursday, July 09, 2009 12:25 AM
An: r-help at r-project.org
Betreff: [R] Population pyramids

Hi, I hope somebody can help me with this issue: I am doing population
pyramids using the barplot command, so in the left side I have male age
structure and in the right side the female age structure. To plot the male
age structure I put the data in negative numbers. Now, I want to change the
sign in the bar plot in such way that I have no-sign numbers, both in left
and right side of the graph. I have been trying all day long and I could not
succed.

Thanks...

Victor

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list