Announcement

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

  • coefplot: Plot-specific axis labels

    Hello,

    I am trying to figure out how to add plot-specific x-axis labels. Specifically, I want to add "OR" to each off the 3 plots' x-axis in the attached graph. It doesn't seem to be possible in the documentation (it's only possible as a global option) but one of Ben Jann's example charts (upper right of page 46 here) seems to have it. Does anyone know how to accomplish this?

    Thanks,
    Bill

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	13.4 KB
ID:	1350924

  • #2
    Is this what you have in mind?

    Code:
    sysuse auto
    regress mpg headroom trunk length turn if foreign==0
    estimates store domestic
    regress price mpg headroom trunk length turn if foreign==1
    estimates store foreign
    coefplot (domestic, xline(100) xlabel(100 "XXX", add) drop(_cons)) || (foreign, xline(1) xlabel(100 "YYY", add) drop(_cons_))

    Comment


    • #3
      Thanks Dimitriy! I had something a bit more like an xtitle in mind (something that sits below, rather than adjacent to, the axis labels), but this is close.

      Comment


      • #4
        In that case, you can use the hack of
        1. adding a single multi-tiered x-axis label where the top tiers are empty and the bottom tier contains the axis title
        2. defining a second label that is numeric to fill the gap.
        In principle, this could could be be automated using the internal temporary variables, but I am lazy.

        The fiddly way is:

        Code:
        webuse lbw, clear
        replace age = age/10
        replace lwt = lwt/100
        
        estimates clear
        logit low age lwt i.smoke if race=="black":race, nolog
        estimates store black
        logit low age lwt i.smoke if race=="white":race, nolog
        estimates store white
        logit low age lwt i.smoke if race=="other":race, nolog
        estimates store other
        
        coefplot (black, eform) || (white, eform) || (other, eform), ///
        xline(1) xlabel(10 `" " " " "OR"' 10 "10", add labsize(small)) drop(_cons)  byopts(row(1))
        This produces:
        Click image for larger version

Name:	coefplot.jpg
Views:	1
Size:	360.8 KB
ID:	1351016



        I am a bit confused why -xlabel(10 `"10" " " "OR"', add labsize(small))- does not work.
        Last edited by Dimitriy V. Masterov; 27 Jul 2016, 14:03.

        Comment


        • #5
          Dimitriy,

          Thanks so much, this is exactly what I needed.

          Bill

          Comment

          Working...
          X