Using the below codes, I could create three graphs and combine them into one nice graph. As shown in the below image, the position and appearance of the legend is not quite right. I would like to have the legend right below the combined graphs. Also, I was wondering if there is any way to wrap up the code using a loop.


twoway kdensity TLE_50_511 || kdensity TLE_50_512 || kdensity TLE_50_513, xtitle("Total Life Expectancy (TLE)") legend(off) name(gr1, replace)

twoway kdensity HLE_50_511 || kdensity HLE_50_512 || kdensity HLE_50_513, legend( pos(6) rows(1) bmargin(large) order (1 "Married non_caregiver" 2 "Spouse caregiver <14h/w" 3 "Spouse caregiver >=14h/w")) xtitle("Healthy Life Expectancy (HLE)") name(gr2, replace)


twoway kdensity PLE_50_511 || kdensity PLE_50_512 || kdensity PLE_50_513, xtitle("PLE (HLE/TLE)") legend(off) name(gr3, replace)

graph combine gr1 gr2 gr3 , ///
rows(1) xsize(12.5) ysize(6)


Array