I'd like to use graph bar with both its exclude0 and stack options. In other words, I want the y axis to not start at 0, and I want to stack multiple variables in each bar.
But this doesn't seem to work. The help file doesn't say a lot about either option, but as far as I can tell stack overrides exclude0. That probably makes sense in a lot of cases but I would still like to use both options.
Can anyone see a way around this?
Example below.
Code:
sysuse auto, clear gen mpg2 = mpg-1 // stack option runs successfully: graph bar mpg mpg2, over(rep78) stack // exclude0 option runs successfully: graph bar mpg mpg2, over(rep78) exclude0 // the two variables stack, but the range returns to default (i.e. includes 0): graph bar mpg mpg2, over(rep78) exclude0 stack // adding ylabel() and yscale(range()) options doesn't help: graph bar mpg mpg2, over(rep78) exclude0 ysc(r(10,60)) yla(10(10)60) graph bar mpg mpg2, over(rep78) exclude0 ysc(r(10,60)) yla(10(10)60) stack graph bar mpg mpg2, over(rep78) ysc(r(10,60)) yla(10(10)60) stack
Thanks in advance.
(Using Stata/IC 14.2)
0 Response to graph bar with both exclude0 and stack - any way to both stack and control the y axis range?
Post a Comment