Announcement

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

  • Add text outside of plot region on COEFPLOT

    Hey Stata-listers,

    I am creating a series of plots for publication. I have multiple plots that I am ultimately combining into one pdf so I want to label each panel with A, B, C, D, etc. I have figured it out for most of my plots (in which I am just plotting two separate plots and using GRAPH COMBINE), by using a NOTE like this:
    Code:
    note("{bf:A}", ring(10) pos(11) size(*3) span)
    For this particular plot, however, I am plotting multiple subplots using one COEFPLOT statement, and then combining that with a similar, albeit slightly modified, COEFPLOT. Here is some example code that will make a plot similar to what I am looking for. I would like to add an "A" in the top left of the plot. I will then store this and combine it with another similar plot that will have a "B" in the top left:
    Code:
    sysuse auto, clear
    
    forv i = 3/5 {    
      quietly regress price mpg headroom weight turn if rep78==`I'    
      estimate store rep78_`i'
    }
    
    coefplot rep78_3 || rep78_4 || rep78_5, drop(_cons) xline(0) ///    
       bycoefs byopts(xrescale)
    Last edited by amandacpac; 19 Jul 2022, 11:42.

  • #2
    Maybe like this?

    Code:
    sysuse auto, clear
    
    forv i = 3/5 {    
      quietly regress price mpg headroom weight turn if rep78==`i'    
      estimate store rep78_`i'
    }
    
    coefplot rep78_3 || rep78_4 || rep78_5, drop(_cons) xline(0) ///    
       bycoefs byopts(xrescale title(A, pos(11)))
    or:

    Code:
    coefplot rep78_3 || rep78_4 || rep78_5, drop(_cons) xline(0) ///    
        bycoefs byopts(xrescale title(A, pos(11) margin(b=-5)))

    Comment


    • #3
      That didn't quite work, but adding the note code I was using to the byopts did work!

      Code:
      sysuse auto, clear
      
      forv i = 3/5 {    
        quietly regress price mpg headroom weight turn if rep78==`I'    
        estimate store rep78_`i'
      }
      
      coefplot rep78_3 || rep78_4 || rep78_5, drop(_cons) xline(0) ///    
         bycoefs byopts(xrescale note("{bf:B}", ring(10) pos(11) size(*3) span))

      Comment

      Working...
      X