Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: yrescale cancels yscale(range()) in graphs by a categorical variable


From   Toby Robertson <toby.robertson@hotmail.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: yrescale cancels yscale(range()) in graphs by a categorical variable
Date   Thu, 21 Jun 2012 15:35:10 +0000

I want to create a set of plots of y on x according to values of a categorical variable c. I would like each plot a) to have its own scale for the y-axis, but b) to begin from zero.The basic syntax 
- twoway scatter y x, by(c)
creates separate graphs with a common y-axis scale, not necessarily starting from zero.
To achieve (a) a separate y-axis scale for each graph (but not necessarily starting from zero) I can use:
- twoway scatter y x, by(c, yrescale)
To have (b) each y-axis start from zero (but with a common scale for all of them) I can use:
- twoway scatter y x, by(c) yscale(range(0))
However, the combination of the two does not achieve (a) and (b).  The -yscale(range(0))- option has no effect.
- twoway scatter y x, by(c, yrescale) yscale(range(0))
What to do? This must be a common enough requirement. Without understanding Stata's graphic object model too well, I think there ought to be a parameter in the yrescale option such as yrescale(min(0)) that would let me do this easily, but there is not. A workaround involving combining separate graphs by category seems tedious.
Toby Robertson 
 		 	   		  
*
*   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   |   Site index