Announcement

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

  • change label in y-axis/x-axis?

    Dear All, I have the following code (please ssc install coefplot) and graph:
    Code:
    webuse grunfeld, clear
    tab year, gen(dy)
    reg invest dy*, nocon
    coefplot, xline(0) msymbol(s) mfcolor(white) ci(50 box) ciopts(recast(rcap))
    and
    Click image for larger version

Name:	pd-year-mean1.png
Views:	1
Size:	124.7 KB
ID:	1524883


    My question is: how can I change the label in vertical axis from (say) "year== 1935.0000" to only "1935"?

    Similarly, the following code
    Code:
    tab year, gen(dy)
    reg invest dy*, nocon
    coefplot, yline(0) vertical msymbol(s) mfcolor(white) ci(50 box) ciopts(recast(rcap))
    generates
    Click image for larger version

Name:	pd-year-mean2.png
Views:	1
Size:	70.0 KB
ID:	1524884

    My additional question is: how can I change the label in horizontal axis to be visible?
    Attached Files
    Ho-Chuan (River) Huang
    Stata 17.0, MP(4)

  • #2
    Nick Cox's -labutil- package contain -labvarch- to changes variable labels .

    Code:
    webuse grunfeld, clear
    tab year, gen(dy)
    reg invest dy*, nocon
    ssc inst labutil
    labvarch dy*, after(==) 
    labvarch dy*, postdrop(5)
    describe
    
    coefplot, xline(0) msymbol(s) mfcolor(white) ci(50 box) /// 
         ciopts(recast(rcap)) xtitle(Coefficients)

    Comment


    • #3
      Dear Scott, Thanks for this useful suggestion.
      Ho-Chuan (River) Huang
      Stata 17.0, MP(4)

      Comment


      • #4
        Dear Scott, I wonder of you can help me with the x label (not readable) of another graph below.
        Code:
        webuse grunfeld, clear
        tab year, gen(dy)
        reg invest dy*, nocon
        *ssc inst labutil
        labvarch dy*, after(==) 
        labvarch dy*, postdrop(5)
        describe
        
        coefplot, yline(0) vertical msymbol(s) mfcolor(white) ci(50 box) ciopts(recast(rcap))
        Click image for larger version

Name:	pd-year-mean3.png
Views:	1
Size:	61.3 KB
ID:	1524958

        Ho-Chuan (River) Huang
        Stata 17.0, MP(4)

        Comment


        • #5
          Dear all, With the help of Scott Merryman and a hint by Nick Cox (https://www.stata.com/statalist/arch.../msg00256.html), I finally find a solution to my problem.
          Code:
          webuse grunfeld, clear
          tab year, gen(dy)
          reg invest dy*, nocon
          *ssc inst labutil
          labvarch dy*, after(==) 
          labvarch dy*, postdrop(5)
          describe
          
          coefplot, yline(0) vertical msymbol(s) mfcolor(white) ci(50 box) ciopts(recast(rcap)) xlabel(, angle(vertical))
          Click image for larger version

Name:	pd-year-mean4.png
Views:	1
Size:	56.2 KB
ID:	1524960

          Ho-Chuan (River) Huang
          Stata 17.0, MP(4)

          Comment

          Working...
          X