Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Relabel using grc1leg

    I am trying to show 4 different graph plots in one same illustration. I am using the command grc1leg.
    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 error I get is "p6 is not a memory graph"

    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")
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	22.8 KB
ID:	1486119



    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)
    Click image for larger version

Name:	Graph1.png
Views:	1
Size:	37.1 KB
ID:	1486118



    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.
    Last edited by Karla Alfaro; 02 Mar 2019, 00:58.

  • #2
    Cross-posted at https://stackoverflow.com/questions/...-using-grc1leg

    Comment

    Working...
    X