Hello folks,
I have three variables A, B, C and D. I am trying to create an area plot
gen total= rowtotal( A B C),m
gen A_share=A/total
gen B_share=B/total
gen C_share=B/total
D is a continuous variable ranging from 0 to 100
I am trying to create area plot for how the share of the three variable evolves with D.
I could not figure out the best way to do this. The closest I have come is creating cumulative variables as follows and then maybe somehow overlap the curves
gen B_share_cuml= A_share+B_share
gen C_share_cuml= Bshare_cuml+C_share
Note C_share_cuml is 1 throughout.
Then, I created line charts using:
twoway lowess A_share D
twoway lowess B_share_cum D
twoway lowess C_share_cuml D
But I cannot figure out the way to combine these three lines in the same chart..
I also used two way area plot but the chart did not come out any where close to a smooth area plot.
twoway area A_share D
Any suggestions would be hugely appreciated. Thanks in advance.
I have three variables A, B, C and D. I am trying to create an area plot
gen total= rowtotal( A B C),m
gen A_share=A/total
gen B_share=B/total
gen C_share=B/total
D is a continuous variable ranging from 0 to 100
I am trying to create area plot for how the share of the three variable evolves with D.
I could not figure out the best way to do this. The closest I have come is creating cumulative variables as follows and then maybe somehow overlap the curves
gen B_share_cuml= A_share+B_share
gen C_share_cuml= Bshare_cuml+C_share
Note C_share_cuml is 1 throughout.
Then, I created line charts using:
twoway lowess A_share D
twoway lowess B_share_cum D
twoway lowess C_share_cuml D
But I cannot figure out the way to combine these three lines in the same chart..
I also used two way area plot but the chart did not come out any where close to a smooth area plot.
twoway area A_share D
Any suggestions would be hugely appreciated. Thanks in advance.
Comment