Hi all,

Assume that you have the following Stata code that generates coefficient plots based on two-way scatter graphs There are two groups, group A and group B, for which we show coefficient plots based on an event.

This code generates coefficient plots that are exactly on top of one another, thus making it difficult to tell them apart when they are close to each other.

I am wondering if there is a way to allow space for the coefficients of the two groups.

In addition, is it possible to somehow reduce the white (empty) space around zero? The white space between -1 and 1 is a bit large.


The pseudo-code follows:

Code:
clear all

input year    coeff1    ci_low1    ci_high1    coeff2    ci_low2    ci_high2
1998    0.307742196    0.297742196    0.317742196    0.643511849    0.623511849    0.663511849
1999    0.707199178    0.697199178    0.717199178    0.687060664    0.667060664    0.707060664
2000    0.253048167    0.243048167    0.263048167    0.204293212    0.184293212    0.224293212
2001    0.579224565    0.569224565    0.589224565    0.429601036    0.409601036    0.449601036
2004    0.684820904    0.674820904    0.694820904    0.520154396    0.500154396    0.540154396
2005    0.561354246    0.551354246    0.571354246    0.169920868    0.149920868    0.189920868
2006    0.33726166    0.32726166    0.34726166    0.298163325    0.278163325    0.318163325
2007    0.745109666    0.735109666    0.755109666    0.813543737    0.793543737    0.833543737
end

gen ry = -4 if year == 1998
replace ry = -3 if year == 1999
replace ry = -2 if year == 2000
replace ry = -1 if year == 2001
replace ry = 0 if year == 2002 | year == 2003
replace ry = 1 if year == 2004
replace ry = 2 if year == 2005
replace ry = 3 if year == 2006
replace ry = 4 if year == 2007

lab var ry "Time relative to event"

* These two lines plus the option cmissing(n) get rid of the event year
tsset year
tsfill

twoway scatter coeff1 ry, lcolor(blue) lwidth(vhick) cmissing(n) msymbol(S) || rcap ci_low1 ci_high1 ry, lcolor(blue%60) lwidth(medthick) lp(solid) || ///
       scatter coeff2 ry, lcolor(red) lwidth(vthick) cmissing(n) msymbol(T) || rcap ci_low2 ci_high2 ry, lcolor(red%60) lwidth(medthick) lp(solid) ///
       legend(order(3 "Group A" 1 "Group B")) ///
       legend(ring(1) position(6) col(2)) ///
       xlabel(-4 -3 -2 -1 0 1 2 3 4, nogrid) ///  
       ylabel(0.1(0.5)1) ///
       xline(0) ///
       title("Example")