The documentation for -twoway bar- reads, "base(#) specifies the value from which the bar should extend. The default is base(0) when 0 falls between the minimum and maximum of yvar. Otherwise, the default base is the value of yvar closest to 0."
But this does not seem to be true:
So, two questions:
1. why does -twoway bar- change behavior depending on whether data is aggregated by mean or sum?
2. why would Stata EVER choose to make the default of a bar graph NOT include 0? Am I missing something here? No other software I've used does this and it seems that cases when you don't want to show 0 on a bar graph are exceptionally rare (not to mention it is much easier to alter the base to exclude 0 than it is to add it back and have to mess with labels again).
But this does not seem to be true:
Code:
// works like anyone outside of Statacorp would expect, but counter to what the documentation says since the min of mpg is >0, but Stata still used base(0): sysuse auto, clear collapse (sum) mpg, by(rep78) twoway bar mpg rep78 // min of mpg is still >0, but now Stata excludes 0, using a default base of the value of yvar closest to 0: sysuse auto, clear collapse (mean) mpg, by(rep78) twoway bar mpg rep78 // now the only way (I know of) to get 0 back is to add base(0) as an option (forcing me to now manually fix the y-axis): twoway bar mpg rep78, base(0)
1. why does -twoway bar- change behavior depending on whether data is aggregated by mean or sum?
2. why would Stata EVER choose to make the default of a bar graph NOT include 0? Am I missing something here? No other software I've used does this and it seems that cases when you don't want to show 0 on a bar graph are exceptionally rare (not to mention it is much easier to alter the base to exclude 0 than it is to add it back and have to mess with labels again).
Comment