Announcement

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

  • line graph connect

    Dear Stata users

    I am trying to do a line graph. Here is my code:

    Code:
    line LOM_breadth_cw_off mean_breadth_cw_off event_time if inrange(event_time,-5,-1) | inrange(event_time,1,5), lp(dash_dot) lc(blue red) ///
        by(l2h, note("") title("Co-movement of own vs peers' decision share for migrant CWs" "across offices with varying intensities", size(medsmall))) ///
        xline(0, lpattern(dash) lw(vthin) lcolor(black)) ylabel(.4(.05)0.6) name(b, replace) ytitle("Share", size(small)) xlabel(-5(1)5) ///
        xtitle("Event time", size(small)) legend(size(small))
    Here is the graph:
    Click image for larger version

Name:	temp.png
Views:	1
Size:	49.1 KB
ID:	1757562




    However, I do not want the line from -1 to 1 to be connected. How can I do this?

    Thanks in advance.

    Zariab Hossain
    Uppsala University
    Last edited by Zariab Hossain; 01 Jul 2024, 14:32.

  • #2
    There is no data example here to allow testing, but I would start with


    Code:
    line LOM_breadth_cw_off mean_breadth_cw_off event_time if inrange(event_time,-5,-1) , lp(dash_dot) lc(blue red) ///
    || line LOM_breadth_cw_off mean_breadth_cw_off event_time if inrange(event_time,1,5), lp(dash_dot) lc(blue red) ///
    by(l2h, note("") title("Co-movement of own vs peers' decision share for migrant CWs" "across offices with varying intensities", size(medsmall))) ///
    xline(0, lpattern(dash) lw(vthin) lcolor(black)) ylabel(.4(.05)0.6) name(b, replace) ytitle("Share", size(small)) xlabel(-5(1)5) ///
        xtitle("Event time", size(small)) legend(size(small))

    Comment


    • #3
      Thanks a lot Nick. It worked perfectly.

      Comment

      Working...
      X