I have to make a stacked area chart in Stata with a vertical line at a certain date. However, I haven't been able to make the line be over the shaded area of the chart. Does anyone know if its even possible?
Here's the code and the chart.
Here's the code and the chart.
Code:
insheet using "https://covid.ourworldindata.org/data/ecdc/full_data.csv", clear
keep if location == "Venezuela" | location == "Colombia"
keep date location new_cases
reshape wide new_cases, i(date) j(location) string
drop if new_casesVenezuela==.
gen year = substr(date,1,4)
gen month = substr(date,6,2)
gen day = substr(date,9,2)
destring year month day, replace
drop date
gen date = mdy(month,day,year)
format date %tdDD-Mon-yyyy
drop year month day
gen date2 = date
gen total = new_casesColombia + new_casesVenezuela
gen porc_col = new_casesColombia / total
gen porc_ven = new_casesVenezuela / total
gen zero = 0
gen uno = 1
gen acum1 = porc_col + porc_ven
twoway rarea zero uno date ///
|| rarea zero porc_col date ///
|| rarea porc_col acum1 date, legend(order(3 "Venezuela" 2 "Colombia") col(1) pos(6)) xtitle("") xline(22100)
graph export "test.png", as(png) replace

Comment