Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Sort order in graph box, over() by()


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   RE: st: Sort order in graph box, over() by()
Date   Tue, 28 Aug 2007 17:19:10 +0100

This seems to produce the same graph as 

. sysuse auto, clear
(1978 Automobile Data)

. graph box mpg, over(rep78) by(foreign)

which appears unproblematic. So the trickery 
of adding the extra observations seems unnecessary. 

My reading of Stefan's posting is that this
is not an analogue of his problem. 

Nick 
[email protected] 

Svend Juul
 
> Stefan Kreisel wrote:
>  
> Is there a way to individually sort the order of boxes
> in a given subgraph as produced by the by() option in
> e.g. -graph box yvar, over(xvar, sort(1)) by(anothergroup)-?
>  
> The problem is that missing categories on a given subgrouping
> of by() get put on the far right most side of the subgraph;
> I want them all in the same position in each subgraph.
>  
> -----------------------------------------------------------
>  
> Scott and Nick had suggestions. But I believe that Stefan
> wanted to use the original "natural" sequence of categories.
> Here is a simple modification of Scott's suggestion:
>  
> sysuse auto, clear
> set obs 76
> replace foreign = 1 in 75/76
> replace rep78 = 1 in 75
> replace rep78 = 2 in 76
> graph box mpg, over(rep78, sort(rep78)) by(foreign)

*
*   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/



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