I am trying to use graph twoway to plot bar graphs overlay line graph, but by two group variables: regionname (Central/North/South) and milestone (10 to 50).
I first try to plot three separate figures for each regionname, by [milesone] variable.
I then combine these three graphs together, and the result is not ideal.

Apparently the grc1leg somehow does not work well. Combining figure approach also uses too much space. I only need one "milestone" heading as well.
Is there a way to graph twoway by two variables?
My full syntax is as below. Thanks a lot.
I first try to plot three separate figures for each regionname, by [milesone] variable.
I then combine these three graphs together, and the result is not ideal.
Apparently the grc1leg somehow does not work well. Combining figure approach also uses too much space. I only need one "milestone" heading as well.
Is there a way to graph twoway by two variables?
My full syntax is as below. Thanks a lot.
Code:
foreach region in "Central" "North" "South" { graph twoway (bar upto_SolarCur year if regionname=="`region'", yaxis(1) color("255 200 68*2") barwidth(0.7) fintensity(inten100) ) /// (bar upto_WindCur year if regionname=="`region'", yaxis(1) color("128 188 0*2") barwidth(0.7) fintensity(inten100)) /// (bar upto_Solar year if regionname=="`region'", yaxis(1) color("255 200 68") barwidth(0.7) fintensity(inten100)) /// (bar upto_Wind year if regionname=="`region'", yaxis(1) color("128 188 0") barwidth(0.7) fintensity(inten100)) /// (bar upto_Hydro year if regionname=="`region'", yaxis(1) color("84 192 232") barwidth(0.7) fintensity(inten100)) /// (bar upto_Other year if regionname=="`region'", yaxis(1) color("167 168 170") barwidth(0.7) fintensity(inten100)) /// (bar upto_Gas year if regionname=="`region'", yaxis(1) color("0 130 202") barwidth(0.7) fintensity(inten100)) /// (bar upto_Coal year if regionname=="`region'", yaxis(1) color("99 101 105") barwidth(0.7) fintensity(inten100)) /// (bar upto_Nuclear year if regionname=="`region'", yaxis(1) color("238 118 35") barwidth(0.7) fintensity(inten100)) /// (connected region_nativeloadmw year if regionname=="`region'", yaxis(1) color("black") msymbol(T)) /// (connected wgtPrice year if regionname=="`region'", yaxis(2) color("75 133 142*2")), /// by(milestone, rows(1) imargin(medium) note("") title("`region'", size(medsmall))) /// xtitle("") xlabel(none) /// ylabel(0(50)350, labsize(small) ang(horizontal) axis(1)) /// ylabel(10(5)30, labsize(small) ang(horizontal) axis(2)) /// legend(label(1 "Solar Cur.") label(2 "Wind Cur.") label(3 "Solar") label(4 "Wind") label(5 "Hydro") label(6 "Other") label(7 "Gas") label(8 "Coal") label(9 "Nuclear") label(10 "Native load") label(11 "Wgt. LMP") order(9 8 7 6 5 4 3 2 1 10 11) cols(6) keygap(*0.3) symxsize(*0.3) size(small)) /// graphregion(color(white)) plotregion(color(white)) gr_edit .style.editstyle boxstyle(shadestyle(color(white))) editcopy gr_edit .l1title.style.editstyle size(small) editcopy graph save Graph\5558_Final_NoSensitivity_MH_Fix\gph\BAR_FuelMixCur_RIIA_`region'_overlay_load_price.gph, replace } ** combine ** grc1leg "Graph\5558_Final_NoSensitivity_MH_Fix\gph\BAR_FuelMixCur_RIIA_Central_overlay_load_price.gph" /// "Graph\5558_Final_NoSensitivity_MH_Fix\gph\BAR_FuelMixCur_RIIA_North_overlay_load_price.gph" /// "Graph\5558_Final_NoSensitivity_MH_Fix\gph\BAR_FuelMixCur_RIIA_South_overlay_load_price.gph", /// cols(1) imargin(zero) title("MISO Regional FuelMix and Curtailment: by RIIA milestones" "Final with Solutions", size(medsmall)) /// l1title("Million MWh", size(small)) r1title("Wgt. LMP ($/MWh)", size(small)) /// graphregion(color(white)) legendfrom("Graph\5558_Final_NoSensitivity_MH_Fix\gph\BAR_FuelMixCur_RIIA_Central_overlay_load_price.gph") foreach x of numlist 1/3{ gr_edit .plotregion1.graph`x'.title.xoffset = -57.5 gr_edit .plotregion1.graph`x'.title.yoffset = -2 }
Comment