Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: graph hbox Y, by(something noiyaxes) over(grp2) over(grp1)


From   Jacob Wegelin <jacob.wegelin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: graph hbox Y, by(something noiyaxes) over(grp2) over(grp1)
Date   Fri, 17 Apr 2009 19:52:11 -0400

The artificial example below creates a "by" plot (two plots, in a row)
with a superfluous row of labels for the levels of -foreign- and of
-headroom- between the left and right graphs. I'd like to eliminate
the second set of labels, that is, those for the plot on the right,
and smash the two plots together with very little space between them.
In particular, the labels "Domestic" and "Foreign" should appear only
once on the entire "by" plot.

The -noixaxes- and -noiyaxes- options seem ineffectual with -graph
hbox-, as does -style(compact)- .  Is there an simple or elegant
solution?

clear all
sysuse auto
set scheme lean1
pause on
egen PriceCat=cut(price), at(3000 6000 16000)
* All axes and labels are printed:
graph hbox turn, by(PriceCat, noiylabel noiyaxes rows(1))
over(headroom) over(foreign)
pause Enter q to continue, BREAK to halt.
* The horizontal axis labels are not printed, which is the opposite of
what I want:
graph hbox turn, by(PriceCat, noixlabel noixaxes rows(1))
over(headroom) over(foreign)
pause Enter q to continue, BREAK to halt.

* Theoretically a workaround would consist in making two plots, the
second one without axis labels for "headroom" and "foreign".
* Then one could use -graph combine-.
* But the following removes the information from the horizontal, i.e.,
the wrong, axis:
graph hbox turn if PriceCat==3000, over(headroom) over(foreign)
ylabel(, nolabels)
pause Enter q to continue, BREAK to halt.
* and the following generates an error. Apparently the vertical axis
is not considered an axis at all in a boxplot:
graph hbox turn if PriceCat==3000, over(headroom) over(foreign)
xlabel(, nolabels)



Thanks for any insights

Jacob A. Wegelin
Assistant Professor
Department of Biostatistics
Virginia Commonwealth University
730 East Broad Street Room 3006
P. O. Box 980032
Richmond VA 23298-0032
U.S.A.
E-mail: jwegelin@vcu.edu
URL: http://www.people.vcu.edu/~jwegelin
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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