Hi Stata folks,
Right now I have the following code. I want to plot my variables (pit_home and nopit_home) on the same graph, but with different y-axis. What are your suggestions for how to do this? tHanks!
Right now I have the following code. I want to plot my variables (pit_home and nopit_home) on the same graph, but with different y-axis. What are your suggestions for how to do this? tHanks!
Code:
gen uprate2=200
local barcall2 uprate2 activemonth_final if inrange(modate, `=tm(2019m6)', `=tm(2019m8)') | inrange(modate, `=tm(2020m6)', `=tm(2020m8)') | inrange(modate, `=tm(2021m6)', `=tm(2021m8)') | inrange(modate, `=tm(2018m6)', `=tm(2018m8)')
twoway bar `barcall2', color(gs13) legend(label(1 "Months Out of School")) || line pit_home activemonth_final if activemonth_final>=`=tm(2018m1)' & activemonth_final<=`=tm(2021m7)', xline(`=tm(2020m3)') xlabel(`=tm(2018m1)' (6) `=tm(2021m7)') xtitle("Date") ytitle("# of Children") legend(label(2 "Pittsburgh")) plotregion(margin(zero)) title("Homelessness Services")
graph export "fig3a_ha.png", as (png) replace
gen uprate3=60
local barcall2 uprate3 activemonth_final if inrange(modate, `=tm(2019m6)', `=tm(2019m8)') | inrange(modate, `=tm(2020m6)', `=tm(2020m8)') | inrange(modate, `=tm(2021m6)', `=tm(2021m8)') | inrange(modate, `=tm(2018m6)', `=tm(2018m8)')
twoway bar `barcall2', color(gs13) legend(label(1 "Months Out of School")) || line nopit_home activemonth_final if activemonth_final>=`=tm(2018m1)' & activemonth_final<=`=tm(2021m7)', xline(`=tm(2020m3)') xlabel(`=tm(2018m1)' (6) `=tm(2021m7)') xtitle("Date") ytitle("# of Children") legend(label(2 "Non-Pittsburgh")) plotregion(margin(zero)) title("Homelessness Services")
graph export "fig3b_ha.png", as (png) replace

Comment