However, if I use relabel in each separate graph the command grc1leg does not recognise the graphs.
My code is the following:
Code:
graph bar (percent) matutino (percent) vespertino, over (p6,relabel (1 "Si" 2 "No")) name(p6, replace) title("¿Trabajas actualmente?") nolabel graph bar (percent) matutino (percent) vespertino if p7>1, over (p7,relabel (1 "0-1" 2 "1-5" 3 "6-11" 4 "12-24" 5 "más de 24")) name(p7, replace) title ("Tiempo trabajando") legend(off) b1title("Meses") graph bar (percent) matutino (percent) vespertino if p8>1, over (p8,relabel (1 "1-3" 2 "4-6" 3 "7-9" 4 "10-12" 5 "13-15" 6 "16-18" 7 "19-21" 8 "22-24" 9 "más de 25")) name(p8, replace) title ("Horas trabajadas a la semana") legend(off) b1title("Horas") destring p9, replace graph bar (percent) matutino (percent) vespertino if p9>1, over (p9,relabel (1 "Independencia" 2 "Gastos personales" 3 "Continuar estudiando" 4 "Experiencia laboral" 5 "Mantener a la familia" 6 "Ayuda en el negocio familiar") label (labsize(small) angle(45))) name(p9, replace) title ("Motivo para trabajar") legend(off) grc1leg p6 p7 p8 p9, l1(Porcentaje) legendfrom(p6)
The code works perfectly for each graph separately, for example:
Code:
graph bar (percent) matutino (percent) vespertino if p7>1, over (p7,relabel (1 "0-1" 2 "1-5" 3 "6-11" 4 "12-24" 5 "más de 24")) name(p7, replace) title ("Tiempo trabajando") legend(off) b1title("Meses")
And the code also works when I combine the four graphs but without the relabel option, for example:
Code:
graph bar (percent) matutino (percent) vespertino, over (p6,) name(p6, replace) title("¿Trabajas actualmente?") nolabel graph bar (percent) matutino (percent) vespertino if p7>1, over (p7) name(p7, replace) title ("Tiempo trabajando") legend(off) b1title("Meses") graph bar (percent) matutino (percent) vespertino if p8>1, over (p8) name(p8, replace) title ("Horas trabajadas a la semana") legend(off) b1title("Horas") destring p9, replace graph bar (percent) matutino (percent) vespertino if p9>1, over (p9) name(p9, replace) title ("Motivo para trabajar") legend(off) grc1leg p6 p7 p8 p9, l1(Porcentaje) legendfrom(p6)
What I want is to have the four graphs in the same illustration but using the string labels I wrote down in each separate graph.
Thanks.
0 Response to Relabel using grc1leg
Post a Comment