Announcement

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

  • coefplot y-axis labels

    Dear users I am using Stata 18.5 and trying to plot O-B decomposition results using coefplot

    Code:
    oaxaca outcome (X1: q_mpce_d2 q_mpce_d3 q_mpce_d4 q_mpce_d5)                        ///
    (X2:head_edu_d2 head_edu_d3 head_edu_d4)                                                ///
    (X3: caste3_d2 caste3_d3) (X4: nssregn_d2 nssregn_d3 nssregn_d4 nssregn_d5 nssregn_d6)    ///
    (X5: sex_hh_d1) (X6: religon_d1 religon_d3) (X7: age_hh)                        ///
    (X8: size_hh_d1 size_hh_d2) [iw=wt], by(residence_d2) omega ro
    
    est sto m1

    After applying oaxaca-blinder decomposition, I am trying to plot the results using coefplot command

    Code:
    coefplot (m1, label(Outcome Variable)), drop(overall:group*) xline(0)                                                               ///
    recast(bar) barwidth(.35) base(0) citop ciopts(recast(rcap))                                                                      ///
    xtitle("Percent", size(small)) xlabel(-.10 "-10" 0 "0" .10 "10" .20 "20" .30 "30" .40 "40" .50 "50" .60 "60")                    ///
    mlabel format(%9.2g) mlabposition(3) mlabsize(tiny) mlabgap(*3) grid(n)                                                        ///
    legend(position(3) ring(0)) scheme(cleanplots)                                                                                 ///
    ylab(1 "Difference" 2 "Explained" 3 "Unxplained"                                                                              /// 1-3 main    
    5 "X1" 6 "X2" 7 "X3" 8 "X4" 9 "X5" 10 "X6" 11 "X7"    12 "X8"                                                                  /// 5-12, factors explained
     14 "X1" 15 "X2" 16 "X3" 17 "X4" 18 "X5" 19 "X6" 20 "X7" 21 "X8"                                                                       /// 14-22, factors unexplained
      22 "Constant", labsize(vsmall))
    The outcome of the above command is shown in the figure attached here.


    My query is:

    How to manage the second (outer) part of the y-axis in the graph, i.e., how to align left, add labels, and rotate its angle?

    Thank you!!
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	73.7 KB
ID:	1767394

    Last edited by Mukesh Punia; 11 Nov 2024, 06:23.
    Best regards,
    Mukesh

    (Stata 15.1 SE)

  • #2
    Ben Jann
    Best regards,
    Mukesh

    (Stata 15.1 SE)

    Comment


    • #3
      Use suboptions within option eqlabels() to affect the rendering of outer labels. Aligning the labels on the left is difficult, see https://repec.sowi.unibe.ch/stata/co...lling.html#h-7

      Comment


      • #4
        thank you, respected Ben Jann, for your response. It worked.

        I have two specific queries-

        1. Is there a way to "hide or drop outer labels"?
        2. I want to combine two graphs/coefplots. Both have the same y-labels but different outcome/dependent variables, so I want to keep y-labels from only one. As shown in the figure attached in post#1. As of now, I did it with gr_edit
        Best regards,
        Mukesh

        (Stata 15.1 SE)

        Comment

        Working...
        X