Announcement

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

  • How to align two lines in the same plots?

    Hi Experts,

    I used the twoway scatter with line command to create 2 lines in one plots. However, there is a lag for these two lines. How can I make these 2 lines vertically aligned? Basically I want to move the read dash line to the left a little bit and make those dots align vertically. Please see my codes below. Thanks!

    twoway ///
    (scatter beta group if group==1 |group==2 , msymbol(S) mcolor(black)) ///
    (scatter beta group if group==3 |group==4 , msymbol(Oh) mcolor(black)) ///
    (scatter beta group if group==5 |group==6 , msymbol(T) mcolor(black)) ///
    (scatter beta group if group==7 |group==8 , msymbol(D) mcolor(black)) ///
    (line beta group if group==1 |group==3 | group==5 |group==7, lcolor(black) lwidth(thin)) ///
    (line beta group if group==2 |group==4 | group==6 |group==8, lpattern(dash) lcolor(red) lwidth(thin)) ///
    , ///
    xlabel(none) ///
    xtitle("", size(large)) ///
    ytitle("β", size(large)) ///
    ylab(-0.02(0.04) 0.16) ///
    legend(order (1 "unadjusted" 2 "adj1" 3 "adj2" 4 "adj3") position(1) row(1)) ///
    graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) ///
    note("line: separate dash: multivariate", size(small) ring(0) position(5)) ///
    name(g10_full, replace)
    [ATTACH=CONFIG]n1378186[/ATTACH]
    Attached Files

  • #2
    Problem solved. I recoded the group variable, and added another variable called group2 to differentiate these 2 lines.

    Comment

    Working...
    X