Dear profs and colleagues,
I am going to combine 2 graphs. In each graph in the xline the box shows years and the related lines. All I need to do is to remove that box from each graph and put only one box in the xline.
Any ideas are appreciated.
Cheers,
Paris
I am going to combine 2 graphs. In each graph in the xline the box shows years and the related lines. All I need to do is to remove that box from each graph and put only one box in the xline.
Code:
* Example generated by -dataex-. For more info, type help dataex clear input float(shr_immg expgr) double year byte sk_rat .06171435 2.5 2010 1 .05453846 2.5 2011 1 .0449036 2.5 2012 1 .04390729 2.5 2013 1 .03895496 2.5 2014 1 .03910635 2.5 2015 1 .04279581 2.5 2016 1 .04302535 2.5 2017 1 .063071 2.5 2018 1 .0894574 2.5 2019 1 .10602682 2.5 2020 1 .10352092 2.5 2021 1 .08200432 2.5 2010 2 .0773884 2.5 2011 2 .07025904 2.5 2012 2 .06849734 2.5 2013 2 .06925854 2.5 2014 2 .07755903 2.5 2015 2 .07361327 2.5 2016 2 .0811235 2.5 2017 2 .09596717 2.5 2018 2 .1220758 2.5 2019 2 .11485728 2.5 2020 2 .1146217 2.5 2021 2 .06260721 2.5 2010 3 .06052116 2.5 2011 3 .05774609 2.5 2012 3 .05200341 2.5 2013 3 .04920107 2.5 2014 3 .04890267 2.5 2015 3 .0518006 2.5 2016 3 .05483922 2.5 2017 3 .069535 2.5 2018 3 .09092128 2.5 2019 3 .08955224 2.5 2020 3 .0826284 2.5 2021 3 .0205613 2.5 2010 4 .02385999 2.5 2011 4 .02410142 2.5 2012 4 .02806499 2.5 2013 4 .033377003 2.5 2014 4 .03494056 2.5 2015 4 .05138873 2.5 2016 4 .05860748 2.5 2017 4 .067040175 2.5 2018 4 .07334909 2.5 2019 4 .07404434 2.5 2020 4 .0745529 2.5 2021 4 .06755392 7.5 2010 1 .06247599 7.5 2011 1 .05508118 7.5 2012 1 .05292348 7.5 2013 1 .05155229 7.5 2014 1 .05364485 7.5 2015 1 .06471722 7.5 2016 1 .07110058 7.5 2017 1 .08763703 7.5 2018 1 .12339999 7.5 2019 1 .1540426 7.5 2020 1 .1529737 7.5 2021 1 .08372635 7.5 2010 2 .08705437 7.5 2011 2 .07872606 7.5 2012 2 .0759871 7.5 2013 2 .08105429 7.5 2014 2 .08917474 7.5 2015 2 .09663171 7.5 2016 2 .10516166 7.5 2017 2 .12653647 7.5 2018 2 .16030076 7.5 2019 2 .16280566 7.5 2020 2 .1823695 7.5 2021 2 .0598473 7.5 2010 3 .06322471 7.5 2011 3 .05262017 7.5 2012 3 .05562126 7.5 2013 3 .05653569 7.5 2014 3 .06050209 7.5 2015 3 .06544687 7.5 2016 3 .07047031 7.5 2017 3 .08401076 7.5 2018 3 .108907 7.5 2019 3 .10477254 7.5 2020 3 .1071877 7.5 2021 3 .021303535 7.5 2010 4 .02407722 7.5 2011 4 .02414379 7.5 2012 4 .02639147 7.5 2013 4 .03146543 7.5 2014 4 .03624856 7.5 2015 4 .04605805 7.5 2016 4 .05516027 7.5 2017 4 .066012345 7.5 2018 4 .0809857 7.5 2019 4 .09259596 7.5 2020 4 .09875655 7.5 2021 4 .0877129 12.5 2010 1 .07381125 12.5 2011 1 .05937796 12.5 2012 1 .05513486 12.5 2013 1 end *Graph (Fig 1, Panel A) twoway (line shr_immg expgr if year==2010 & sk_rat==1, lcolor(yellow)) /// (line shr_immg expgr if year==2011 & sk_rat==1, lcolor(Sand) lpat(dash_3dot)) /// (line shr_immg expgr if year==2012 & sk_rat==1, lcolor(gs7) lpat(vshortdash)) /// (line shr_immg expgr if year==2013 & sk_rat==1, lcolor(brown) lpat(dot)) /// (line shr_immg expgr if year==2014 & sk_rat==1, lcolor(olive) lpat(dash)) /// (line shr_immg expgr if year==2015 & sk_rat==1, lcolor(maroon) lpat(solid)) /// (line shr_immg expgr if year==2016 & sk_rat==1, lcolor(navy) lpat(short-dash)) /// (line shr_immg expgr if year==2017 & sk_rat==1, lcolor(gs10) lpat(dash-3-dot)) /// (line shr_immg expgr if year==2018 & sk_rat==1, lcolor(purple) lpat(short-dash)) /// (line shr_immg expgr if year==2019 & sk_rat==1, lcolor(khaki) lpat(vshortdash)) /// (line shr_immg expgr if year==2020 & sk_rat==1, lcolor(red) lpat(dash_3dot)) /// (line shr_immg expgr if year==2021 & sk_rat==1, lcolor(green) lpat(tight-dot)),legend(label(1 "2010") /// label(2 "2011") label(3 "2012") label(4 "2013") label(5 "2014") label(6 "2015") label(7 "2016")label(8 "2017")label(9 "2018")label(10 "2019")label(11 "2020")label(12 "2021")size(small) cols(12)) ylab(,nogrid) ///, ti("Panel A: 1st Quartile", size(small) color(black)) xti("Years of Experience", size(small)) /// yti("Immigrant Share", size(small)) graphr(ic(white) ifc(white) ilc(white) fcolor(white) lcolor(white)) /// saving (Quartile1_Fig1.gph) *Graph (Fig 1, Panel B) twoway (line shr_immg expgr if year==2010 & sk_rat==2, lcolor(yellow)) /// (line shr_immg expgr if year==2011 & sk_rat==2, lcolor(sand) lpat(dash_3dot)) /// (line shr_immg expgr if year==2012 & sk_rat==2, lcolor(gs7) lpat(vshortdash)) /// (line shr_immg expgr if year==2013 & sk_rat==2, lcolor(brown) lpat(dot)) /// (line shr_immg expgr if year==2014 & sk_rat==2, lcolor(olive) lpat(dash)) /// (line shr_immg expgr if year==2015 & sk_rat==2, lcolor(maroon) lpat(solid)) /// (line shr_immg expgr if year==2016 & sk_rat==2, lcolor(navy) lpat(vshortdash)) /// (line shr_immg expgr if year==2017 & sk_rat==2, lcolor(gs10) lpat(dash-3-dot)) /// (line shr_immg expgr if year==2018 & sk_rat==2, lcolor(purple) lpat(short-dash)) /// (line shr_immg expgr if year==2019 & sk_rat==2, lcolor(khaki) lpat(dash_3dot)) /// (line shr_immg expgr if year==2020 & sk_rat==2, lcolor(red) lpat(dash_3dot)) /// (line shr_immg expgr if year==2021 & sk_rat==2, lcolor(green) lpat(tight-dot)),legend(label(1 "2010") /// label(2 "2011") label(3 "2012") label(4 "2013") label(5 "2014") label(6 "2015") label(7 "2016")label(8 "2017")label(9 "2018")label(10 "2019")label(11 "2020")label(12 "2021")size(small) cols(12)) ylab(,nogrid) /// ti("Panel B: 2nd Quartile", size(small) color(black)) xti("Years of Experience", size(small)) /// yti("Immigrant Share", size(small))graphr(ic(white) ifc(white) ilc(white) fcolor(white) lcolor(white)) /// saving(Quartile2_Fig1.gph) graph combine Quartile1_Fig1.gph Quartile2_Fig1.gph
Cheers,
Paris
Comment