Dear Stata users,
I have plotted two twoway line graphs and the code is below:
preserve
keep if no_emp_before_close==1
keep if inrange(event_time,-5,5)
gcollapse (mean) office_WS, by(event_time)
label var office_WS "0 employee office before closings"
grstyle init
grstyle set plain, dot horizontal grid
twoway (line office_WS event_time, yaxis(1)) ///
, graphregion(color(white)) plotregion(color(white)) xline(0, lcolor(black) lpattern(dash)) graphregion(color(white)) name(c, replace) ///
title("O employee offices before actual closures", size(small)) subtitle("(for kommun closed between 2014-2017)", size(small))
restore
preserve
keep if no_CW_before_close==1
keep if inrange(event_time,-5,5)
gcollapse (mean) office_WS, by(event_time)
label var office_WS "0 CW office before closings"
grstyle init
grstyle set plain, dot horizontal grid
twoway (line office_WS event_time, yaxis(1)) ///
, graphregion(color(white)) plotregion(color(white)) xline(0, lcolor(black) lpattern(dash)) graphregion(color(white)) name(a, replace) ///
title("O CW offices before actual closures", size(small)) subtitle("(for kommun closed between 2014-2017)", size(small))
restore
I want to overlay these two separate twoway lines in the same graph. In each graph I condition the sample at the first line. Is there any way to do it? Any help would be highly appreciated.
Thanks
Zariab Hossain
Uppsala University
I have plotted two twoway line graphs and the code is below:
preserve
keep if no_emp_before_close==1
keep if inrange(event_time,-5,5)
gcollapse (mean) office_WS, by(event_time)
label var office_WS "0 employee office before closings"
grstyle init
grstyle set plain, dot horizontal grid
twoway (line office_WS event_time, yaxis(1)) ///
, graphregion(color(white)) plotregion(color(white)) xline(0, lcolor(black) lpattern(dash)) graphregion(color(white)) name(c, replace) ///
title("O employee offices before actual closures", size(small)) subtitle("(for kommun closed between 2014-2017)", size(small))
restore
preserve
keep if no_CW_before_close==1
keep if inrange(event_time,-5,5)
gcollapse (mean) office_WS, by(event_time)
label var office_WS "0 CW office before closings"
grstyle init
grstyle set plain, dot horizontal grid
twoway (line office_WS event_time, yaxis(1)) ///
, graphregion(color(white)) plotregion(color(white)) xline(0, lcolor(black) lpattern(dash)) graphregion(color(white)) name(a, replace) ///
title("O CW offices before actual closures", size(small)) subtitle("(for kommun closed between 2014-2017)", size(small))
restore
I want to overlay these two separate twoway lines in the same graph. In each graph I condition the sample at the first line. Is there any way to do it? Any help would be highly appreciated.
Thanks
Zariab Hossain
Uppsala University
Comment