I'm attempting to combine a line graph and a bar graph that need to line up along the x-axis. For that to work, the bar graph needs to start exactly at 0; however, the default seems to be to add a bit of space at the left and right sides of the x-axis.
I specified the xscale range to start at 0, but that seems not to be respected.
When I use the graph editor, I can correct the problem by selecting the x-axis, clicking on "more", selecting "scale", ticking the "Extend range of axis scale" and entering 0 and 18 to replace the default of -0.235 and 18.325 (see screenshot). Any ideas on how to make this happen without the graph editor? The code below replicates the problem.
I am using Stata SE version 17.

I specified the xscale range to start at 0, but that seems not to be respected.
When I use the graph editor, I can correct the problem by selecting the x-axis, clicking on "more", selecting "scale", ticking the "Extend range of axis scale" and entering 0 and 18 to replace the default of -0.235 and 18.325 (see screenshot). Any ideas on how to make this happen without the graph editor? The code below replicates the problem.
I am using Stata SE version 17.
Code:
webuse mumps2.dta, clear gen panel=1 in 1/19 replace panel=2 in 20/38 drop if panel==. gen mo=_n-1 if panel==1 replace mo=_n-20 if panel==2 set scheme s1color twoway (bar mumps mo if panel==1, fcolor(eltblue) barwidth(.65) ) /// (bar mumps mo if panel==2, fcolor(navy%75) barwidth(.65))/// , xlabel(0(1)18) xscale(range(0 18)) legend(off)
Comment