Dec 18, 2014

Random graphs (40): Line plot

clear 
// Read in Table
input str4 cntry P1970 P1991 P1998 P2008 S1970 S1991 S1998 S2008 T1970 T1991 T1998 T2008
EU15 16.2 7.6 4.5 3.4 37.4 28.6 26.6 23.2 54 73 68.9 73.5
DE 8 3.4 2.5 2.1 48 35 30.4 25.3 44 62 67.1 72.5
FI 20 8 6.3 4.8 34 29 27.8 25.6 46 63 65.9 69.6
NL 6 4 3.6 3 36 24 19.9 16.7 58 72 76.5 80.3
SE 8 4 3.1 2.2 39 28 25.1 22.7 53 68 71.8 75.1
UK 3 2.1 1.9 1.5 42 25 . 17.7 55 73 75.3 80.7
CZ 13.5 10 5.6 3.5 49.4 45.9 41.4 38 37 44 53 58.6
end

// Crazy stuff to bring it into shape
preserve

drop S1970-T2008

reshape long P, i(cntry) j(year)

tempfile p
save `p', replace

restore

preserve 
drop P1970-P2008 T1970-T2008

reshape long S, i(cntry) j(year)

tempfile s
save `s', replace

restore

drop P1970-S2008

reshape long T, i(cntry) j(year)

merge 1:1 cntry year using `p'
drop _merge
merge 1:1 cntry year using `s'

// Plot
twoway (scatter P year if cntry == "EU15", connect(L)) ///
       (scatter S year if cntry == "EU15", connect(L)) ///
       (scatter T year if cntry == "EU15", connect(L)) ///
      , ytitle("Percentage of EU-15 workforce") ///
        xtitle("") ///
        note(" " "{it: Source:} Mau and Verwiebe 2010, pp. 153{c 150}4", span) /// 
        legend(label(1 "{bf:Primary sector:}" "Agriculture") ///
               label(2 "{bf:Secondary sector:}" "Industry and" "construction") /// 
               label(3 "{bf:Tertiary sector:}" "Services")) ///
        xlabel(1970 1991 1998 2008)