Announcement

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

  • use Event_plot command, how to modify line color, line pattern, etc.

    Dear Statalist:

    I have a county-level panel data. I want to draw event study dynamics for (counties in coastal area) and (counties in inland area) in the same plot. I also want to modify the graph options but failed to achieve the graph I wanted.

    Here is my code:
    Code:
    * run the first regression for counties in coastal area
    reghdfe lny F* L* if eastcoastal == 1, absorb(id year i.id#c.t ) cluster(id)
    
    * save the coefficients in matrix
    matrix coastal_b = e(b)
    matrix coastal_v = e(V) 
         
    * run the second regression for counties in inland area
    reghdfe lny F* L* if eastcoastal == 0, absorb(id year i.id#c.t ) cluster(id)
    
    * save the results
    matrix inland_b = e(b)
    matrix inland_v = e(V)
    
    * use event_plot to draw
    event_plot coastal_b#coastal_v inland_b#inland_v, plottype(connected) ciplottype(rcap) stub_lag(L#) stub_lead(F#) together ///
        graph_opt(   ///
        xtitle("Periods since the event") ///
        ytitle("Average causal effect")   ///
        xlabel(-5(1)8)  ///
        yline(0, lp(dash) lc(gs0) lw(thin)) ///
        xline(-0.5, lp(dash) lc(gs0) lw(thin)) ) ///
        lag_opt(color(navy)) ///
        lead_opt(color(red)) lag_ci_opt(color(navy%45 navy%45))  ///
        lead_ci_opt(color(red%45 red%45))
    Then, Stata give me this plot: Why the two lines are both blue ??
    Click image for larger version

Name:	Graph2.png
Views:	1
Size:	48.9 KB
ID:	1710990



    I want to modify this this plot in the following aspects:
    1) change the format of two lines ( one is blue dashed line, one is red solid line)
    2) change the opacity of CI (CI color matches the corresponding line colors)
    3) label the legend into some text description

    Does anyone know how to fix this ? I will be very appreciated !!!







    Attached Files
Working...
X