Announcement

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

  • How to change the color on the x, y axes labels

    How is the health of friends. One question please: How to change the color on the x, y axes
    I want white color on the x, y axes labels (figure N° 1)

    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input long cdpto int año double fgt float(war line004 line008)
    1 2010 50.45358460905211 . 20 30
    1 2011 44.56099581988956 . 20 30
    1 2012 44.47837710187593 . 20 30
    1 2013 47.31285045180137 . 20 30
    1 2014 51.30921677752137 . 20 30
    1 2015 42.28657959492714 . 20 30
    1 2016 39.70988726634459 30 20 30
    1 2017 34.880030642116495 30 20 30
    1 2018 33.512735579668714 30 20 30
    1 2019 30.489214000418517 30 20 30
    1 2020 36.11814774703212 30 . .
    2 2010 27.077980420718667 . 20 30
    2 2011 27.208232751348955 . 20 30
    2 2012 27.43309610380656 . 20 30
    2 2013 23.50490002935602 . 20 30
    2 2014 23.943306383398966 . 20 30
    2 2015 24.045336829414683 . 20 30
    2 2016 21.678544672839646 30 20 30
    2 2017 22.35510931322693 30 20 30
    2 2018 20.314534403524014 30 20 30
    2 2019 17.542837190216733 30 20 30
    2 2020 29.828357804443456 30 . .
    3 2010 62.007047142956374 . 20 30
    3 2011 56.97382050433454 . 20 30
    3 2012 55.51031629935422 . 20 30
    3 2013 42.75892149756413 . 20 30
    3 2014 42.58870065185263 . 20 30
    3 2015 38.66464161399215 . 20 30
    3 2016 38.16283765602253 30 20 30
    3 2017 35.901719276674235 30 20 30
    3 2018 31.76823388092783 30 20 30
    3 2019 29.083975520359353 30 20 30
    3 2020 35.466443416632806 30 . .
    4 2010 13.629401380405556 . 20 30
    4 2011 11.498256991311331 . 20 30
    4 2012 11.902182508303016 . 20 30
    4 2013 9.05182005357761 . 20 30
    4 2014 7.7725206563572 . 20 30
    4 2015 8.236622318116543 . 20 30
    4 2016 8.307346250191708 30 20 30
    4 2017 8.060889341870077 30 20 30
    4 2018 8.57927134832722 30 20 30
    4 2019 6.009584356431234 30 20 30
    4 2020 18.56475931932497 30 . .
    5 2010 48.20205685538229 . 20 30
    5 2011 52.72353395422843 . 20 30
    5 2012 52.62304727893432 . 20 30
    5 2013 51.9211272739699 . 20 30
    5 2014 47.36932675528731 . 20 30
    5 2015 40.72472379640764 . 20 30
    5 2016 37.46039747557665 30 20 30
    5 2017 35.60754170496008 30 20 30
    5 2018 37.46445455085329 30 20 30
    5 2019 39.35614657470858 30 20 30
    5 2020 46.36770931245763 30 . .
    6 2010 55.169304134697384 . 20 30
    6 2011 55.81783589741568 . 20 30
    6 2012 54.16541547749293 . 20 30
    6 2013 52.894036074963594 . 20 30
    6 2014 50.65247850608024 . 20 30
    6 2015 50.848954748850595 . 20 30
    6 2016 48.234070991691794 30 20 30
    6 2017 47.53355107806847 30 20 30
    6 2018 41.88344834716078 30 20 30
    6 2019 37.95968893948596 30 20 30
    6 2020 42.53306148262104 30 . .
    7 2010 42.73270699463585 . 20 30
    7 2011 29.6540822376318 . 20 30
    7 2012 21.917150859253635 . 20 30
    7 2013 18.779599485923995 . 20 30
    7 2014 18.68396377103102 . 20 30
    7 2015 17.595765361344498 . 20 30
    7 2016 20.434424785703616 30 20 30
    7 2017 25.24985359848939 30 20 30
    7 2018 22.942914321027107 30 20 30
    7 2019 23.00061850204696 30 20 30
    7 2020 32.140259112336956 30 . .
    8 2010 62.89379587227899 . 20 30
    8 2011 54.636502453802414 . 20 30
    8 2012 49.46823829297042 . 20 30
    8 2013 46.55611811478474 . 20 30
    8 2014 52.27952705513421 . 20 30
    8 2015 45.15868524675204 . 20 30
    8 2016 44.68028431359114 30 20 30
    8 2017 38.882650526043975 30 20 30
    8 2018 38.723295356869336 30 20 30
    8 2019 36.91251588322443 30 20 30
    8 2020 47.66737954856063 30 . .
    9 2010 54.68130318318205 . 20 30
    9 2011 54.12536199436243 . 20 30
    9 2012 44.91591657113688 . 20 30
    9 2013 40.107441268795405 . 20 30
    9 2014 39.95968997216527 . 20 30
    9 2015 35.60231945319434 . 20 30
    9 2016 32.65402291966365 30 20 30
    9 2017 34.29539868175905 30 20 30
    9 2018 29.861101735722034 30 20 30
    9 2019 29.36796102256392 30 20 30
    9 2020 42.56290405667885 30 . .
    end
    label values cdpto cdpto
    label def cdpto 1 "Amazonas", modify
    label def cdpto 2 "Ancash", modify
    label def cdpto 3 "Apurimac", modify
    label def cdpto 4 "Arequipa", modify
    label def cdpto 5 "Ayacucho", modify
    label def cdpto 6 "Cajamarca", modify
    label def cdpto 7 "Cusco", modify
    label def cdpto 8 "Huancavelica", modify
    label def cdpto 9 "Huanuco", modify


    **gráfico N° 1
    summarize año
    local xmax `r(max)'
    #delimit ;
    local opts "legend(off) graphregion(color(0 28 112))
    ylabel(0.0 "0" 10 "10" 20 "20" 30 "30" 40 "40" 50 "50" 60 "60", ang(h) nogri) xlabel(`r(min)'(2)`r(max)', ang(h) nogri) ytitle("%",color("255 255 255")) xtitle("Año", color("252 203 2"%80))" ;
    #delimit cr
    *set scheme cleanplots
    *set scheme s2color
    graph set window fontface "Garamond Bold"
    la var año "Año"

    graph twoway (area fgt año, base(0.0) ysc(r(0.0 0.15)) fcolor("252 228 44") lwidth(*0.0 ..) lcolor("252 228 44")), by(cdpto, graphregion(color(0 28 112)) plotregion(fcolor("0 28 112") lcol(0 28 112)) ) `opts' ///
    plotregion(fcolor(0 28 112) margin(zero)) legend(off) graphregion(color(0 28 112) margin(zero))


    **gráfico N° 2
    **fabplot ssc
    ssc install fabplot
    set scheme s1color
    summarize año
    local xmax `r(max)'
    local min = `r(min)'
    local max = `r(max)'
    fabplot line fgt año, by(cdpto) frontopts(lw(thick)) xla(`min'(2)`max', grid) xtitle("año 2010 2020")
    Last edited by Andrés Lahur Talavera Cuya; 27 Aug 2021, 14:43.

  • #2
    Thanks for the data example.

    Code:
    **gráfico N° 1
    summarize año
    local xmax `r(max)'
    #delimit ;
    local opts "legend(off) graphregion(color(0 28 112))
    ylabel(0.0 "0" 10 "10" 20 "20" 30 "30" 40 "40" 50 "50" 60 "60", labcolor(white) ang(h) nogri) xlabel(`r(min)'(2)`r(max)', ang(h) nogri labcolor(white)) ytitle("%",color("255 255 255")) xtitle("Año", color("252 203 2"%80))" ;
    #delimit cr
    *set scheme cleanplots
    *set scheme s2color
    graph set window fontface "Garamond Bold"
    la var año "Año"
    
    graph twoway (area fgt año, base(0.0) ysc(r(0.0 0.15)) fcolor("252 228 44") lwidth(*0.0 ..) lcolor("252 228 44")), by(cdpto, graphregion(color(0 28 112)) plotregion(fcolor("0 28 112") lcol(0 28 112)) ) `opts' ///
    plotregion(fcolor(0 28 112) margin(zero)) legend(off) graphregion(color(0 28 112) margin(zero))

    Comment


    • #3
      Thank you so much

      Comment


      • #4
        Hi Andrew Musau , in this other case, please, how is the solution?


        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input float(dpto ingresolab escol)
        1 1013.9626 9.196111
        2 1230.937 10.220387
        3 1123.75 9.822726
        4 1703.0623 11.635722
        5 970.6492 9.144975
        6 954.4032 8.579683
        7 1579.5913 11.61429
        8 1234.104 9.928216
        9 742.0622 8.745617
        10 1007.0563 8.636182
        11 1507.511 11.71254
        12 1206.3406 10.341873
        13 1307.499 10.173422
        14 1203.5992 10.49977
        15 1885.933 11.731456
        16 1231.499 9.71659
        17 1664.9967 10.320028
        18 1801.473 11.549447
        19 1171.9832 10.26713
        20 1145.9607 9.717319
        21 876.1393 9.913848
        22 1159.17 9.0257225
        23 1392.292 11.177816
        24 1264.2872 10.25971
        25 1174.4493 9.847914
        end
        label values dpto dpto
        label def dpto 1 "Amazonas", modify
        label def dpto 2 "Ancash", modify
        label def dpto 3 "Apurimac", modify
        label def dpto 4 "Arequipa", modify
        label def dpto 5 "Ayacucho", modify
        label def dpto 6 "Cajamarca", modify
        label def dpto 7 "Callao", modify
        label def dpto 8 "Cusco", modify
        label def dpto 9 "Huancavelica", modify
        label def dpto 10 "Huanuco", modify
        label def dpto 11 "Ica", modify
        label def dpto 12 "Junin", modify
        label def dpto 13 "La_Libertad", modify
        label def dpto 14 "Lambayeque", modify
        label def dpto 15 "Lima", modify
        label def dpto 16 "Loreto", modify
        label def dpto 17 "Madre_de_Dios", modify
        label def dpto 18 "Moquegua", modify
        label def dpto 19 "Pasco", modify
        label def dpto 20 "Piura", modify
        label def dpto 21 "Puno", modify
        label def dpto 22 "San_Martin", modify
        label def dpto 23 "Tacna", modify
        label def dpto 24 "Tumbes", modify
        label def dpto 25 "Ucayali", modify

        #delimit;
        graph hbar ingresolab , blabel(total, c("255 255 255") format(%9.1f))
        bar(1, c("252 203 2"))
        over(dpto , sort(1) descending label(labc("252 228 44")))
        text(1700 20 "anotation", c("255 255 255"))
        tit("{bf:Figura N° 1:} " "{it:Perú: Ingreso laboral por departamentos, $año} ", c("252 203 2"%80) position(11) span ) subtitle("{it (Soles corrientes) } ", c("252 203 2"%80) position(11) span )
        b1title(" ") ytitl(" ", c("255 255 255"))
        note(" " "{bf:Nota}: ENAHO 2019, elaboración propia Andrés Talavera @atalaveracuya", c("119 119 119%50") span)
        graphregion(color(0 28 112)) plotregion(fcolor(0 28 112))
        scheme(cleanplots)
        xsize(5) ysize(4);
        graph export "$analisis\ingresolaboralExportPPTsize.png" , width(1500) height(1100) replace ;
        #delimit cr
        [/CODE]
        Last edited by Andrés Lahur Talavera Cuya; 16 Sep 2021, 10:47.

        Comment


        • #5
          Same option.

          Code:
          #delimit;
          graph hbar ingresolab , blabel(total, c("255 255 255") format(%9.1f))
          bar(1, c("252 203 2"))
          over(dpto , sort(1) descending label(labc("252 228 44")))
          text(1700 20 "anotation", c("255 255 255"))
          tit("{bf:Figura N° 1:} " "{it:Perú: Ingreso laboral por departamentos, $año} ", c("252 203 2"%80) position(11) span ) subtitle("{it (Soles corrientes) } ", c("252 203 2"%80) position(11) span )
          b1title(" ") ytitl(" ", c("255 255 255"))
          note(" " "{bf:Nota}: ENAHO 2019, elaboración propia Andrés Talavera @atalaveracuya", c("119 119 119%50") span)
          graphregion(color(0 28 112)) plotregion(fcolor(0 28 112))
          scheme(cleanplots)
          xsize(5) ysize(4) ylab(, labcolor(white));
          graph export "$analisis\ingresolaboralExportPPTsize.png" , width(1500) height(1100) replace ;
          #delimit cr

          Comment


          • #6
            thank you very much Andrew.
            On the other hand, what is the code to change the color of the axes

            Click image for larger version

Name:	Captura.PNG
Views:	1
Size:	28.8 KB
ID:	1627775

            Comment


            • #7
              If you show the numbers, the axis is redundant and you'll get some sorely needed vertical space by omitting it. Also, translate the underscores _ to spaces in the names.

              Comment


              • #8
                Thank you so much!!

                Code:
                * Example generated by -dataex-. For more info, type help dataex
                clear
                input float(dpto ingresolab escol)
                1 1013.9626 9.196111
                2 1230.937 10.220387
                3 1123.75 9.822726
                4 1703.0623 11.635722
                5 970.6492 9.144975
                6 954.4032 8.579683
                7 1579.5913 11.61429
                8 1234.104 9.928216
                9 742.0622 8.745617
                10 1007.0563 8.636182
                11 1507.511 11.71254
                12 1206.3406 10.341873
                13 1307.499 10.173422
                14 1203.5992 10.49977
                15 1885.933 11.731456
                16 1231.499 9.71659
                17 1664.9967 10.320028
                18 1801.473 11.549447
                19 1171.9832 10.26713
                20 1145.9607 9.717319
                21 876.1393 9.913848
                22 1159.17 9.0257225
                23 1392.292 11.177816
                24 1264.2872 10.25971
                25 1174.4493 9.847914
                end
                label values dpto dpto
                label def dpto 1 "Amazonas", modify
                label def dpto 2 "Ancash", modify
                label def dpto 3 "Apurimac", modify
                label def dpto 4 "Arequipa", modify
                label def dpto 5 "Ayacucho", modify
                label def dpto 6 "Cajamarca", modify
                label def dpto 7 "Callao", modify
                label def dpto 8 "Cusco", modify
                label def dpto 9 "Huancavelica", modify
                label def dpto 10 "Huanuco", modify
                label def dpto 11 "Ica", modify
                label def dpto 12 "Junin", modify
                label def dpto 13 "La Libertad", modify
                label def dpto 14 "Lambayeque", modify
                label def dpto 15 "Lima", modify
                label def dpto 16 "Loreto", modify
                label def dpto 17 "Madre de Dios", modify
                label def dpto 18 "Moquegua", modify
                label def dpto 19 "Pasco", modify
                label def dpto 20 "Piura", modify
                label def dpto 21 "Puno", modify
                label def dpto 22 "San Martin", modify
                label def dpto 23 "Tacna", modify
                label def dpto 24 "Tumbes", modify
                label def dpto 25 "Ucayali", modify
                
                #delimit;
                graph hbar ingresolab , blabel(total, c("255 255 255") format(%9.1f) )
                bar(1, c("252 203 2"))  
                over(dpto , sort(1) descending label(labc("252 228 44")))
                text(1700 20 "anotation", c("255 255 255"))
                tit("{bf:Figura N° 1:} " "{it:Perú: Ingreso laboral por departamentos, 2019} ", c("252 203 2"%80) position(11) span ) subtitle("{it:(Soles corrientes) } ", c("252 203 2"%80) position(11) span )
                b1title(" ") ytitl(" ", c("255 255 255"))
                legend(off) yscale(off) ylabel(0(500)2000,nogrid) yscale(range(0 2000))
                ylab(, labcolor(white))
                note(" " "{bf:Nota}: ENAHO 2019, elaboración propia Andrés Talavera @atalaveracuya", c("119 119 119%50") span)  
                graphregion(color(0 28 112)) plotregion(fcolor(0 28 112))
                scheme(cleanplots)
                xsize(5) ysize(4);
                graph export "$analisis\g1.png" , width(1500) height(1100) replace ;
                #delimit cr
                Click image for larger version

Name:	Graph.png
Views:	1
Size:	39.9 KB
ID:	1627831

                Comment

                Working...
                X