Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: please help me with noixlabel

From   May Boggess <>
Subject   Re: st: please help me with noixlabel
Date   21 Jul 2003 14:36:18 -0500

Dimitriy V. Masterov <> 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
	. 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))


*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index