Dimitriy V. Masterov <[email protected]> asked about how
to control labelling of the x axis on a bar graph.
> graph bar testscore, over(sex) over(race) by(age)
>
> The problem I am having is that when Stata stacked the plots by age on top
> of each other, the x axis in every single plot is labeled, which takes up
> a lot of valuable room. I would like to only label the bottom plot (for
> age=max(age)).
>
The reason Stata wants to label the x axis on each of the graphs, is
that each bar graph may have a different range on the x axis. You can
see this in the following example:
. use http://www.stata-press.com/data/r8/auto1
. graph bar mpg, by( headroom ) over( foreign )
An alternative is to use -twoway bar-.
. bysort headroom foreign: egen mean=mean(mpg)
. twoway bar mean foreign , by( headroom ) xlabel(0 "Domestic" 1
"Foreign") xscale(r(-.5,1.5)) yscale(r(0,30)) xtitle("") ytitle("mean of
mpg") barwidth(.6) plotregion(margin(zero))
--May
[email protected]
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/