Hi,
Is there any way to create a stacked area chart as below:
Is there any way to create a stacked area chart as below:
preserve keep if country=="Australia" *GENERATE GRAPH AND SAVE restore, preserve keep if country=="Austria" *GENERATE GRAPH AND SAVE restore, preserve
clear set obs 100 gen country = word("Australia Austria Belgium Canada", ceil(_n/25)) set seed 2803 forval j = 1/4 { gen y`j' = `j' * runiform() } egen Y = rowtotal(y*) gen p1 = 100 * y1/Y gen P2 = 100 * (y1 + y2) / Y gen P3 = 100 * (y1 + y2 + y3) / Y gen P4 = 100 bysort country : gen year = _n + 1979 twoway area p1 year || rarea p1 P2 year || rarea P2 P3 year || rarea P3 P4 year, /// by(country, note("")) ytitle(percent of total) xla(1980(5)2005) xtitle("") yla(0(25)100, ang(h)) legend(order(4 "4" 3 "3" 2 "2" 1 "1") row(1))
Comment