Announcement

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

  • Coefplot colors across subgraphs

    Hi,

    I would like to use coefplot to plot different regression results on the same graph. I would like to control the color of each coef plot but somehow I fail to do so. Typically I would like to present on the same graph the impact on the full sample and on two sub-groups. Here is an example:
    Code:
    sysuse auto.dta
    
    reg price mpg
    est store fs
    
    reg price mpg if foreign ==0
    est store f0
    
    reg price mpg if foreign ==1
    est store f1
    
    coefplot fs || (f0, offset(-0.15)) (f1, offset(+0.15)) ||, vertical bycoefs keep(mpg) nooffsets
    My problem is that the full sample plot is the same color than the first heterogenous effect while I would like them to have 2 different colors. I tried this

    Code:
    coefplot fs, pstyle(p1) || (f0, offset(-0.15)  pstyle(p2)) (f1, offset(+0.15) pstyle(p3)) , vertical bycoefs keep(mpg) nooffsets
    but weirdly the style in the second subgraph overwrites the style of the first..

    Do you have an idea to give individuals color to each subgraph?

    Thanks

  • #2
    coefplot is from the Stata Journal/ SSC, as you are asked to explain (FAQ Advice #12). Here, you want the option -norecycle-

    Comment


    • #3
      That works perfectly thanks so much. Will add the command ref in the future.

      Comment

      Working...
      X