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]

From |
Nick Cox <n.j.cox@durham.ac.uk> |

To |
"'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |

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

Date |
Thu, 21 Jun 2012 16:51:08 +0100 |

I don't have a good answer. The answer to many of these small -by:- problems is to tuck an extra option inside -by()- but that doesn't work here. I do have a work-around. sysuse auto gen zero = 0 scatter price zero length, by(foreign, yrescale legend(off)) ms(Oh none) ytitle("`: var label price'") Here you have a variable that is identically zero and so forces the scale to begin at zero. But you have to zap the legend and marker symbol that you don't want and reinstate the axis title that you do want. Nick n.j.cox@durham.ac.uk Toby Robertson 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. * * 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/

**Follow-Ups**:**st: RE: RE: yrescale cancels yscale(range()) in graphs by a categorical variable***From:*Nick Cox <n.j.cox@durham.ac.uk>

**References**:**st: yrescale cancels yscale(range()) in graphs by a categorical variable***From:*Toby Robertson <toby.robertson@hotmail.com>

- Prev by Date:
**st: RE: Exported FLAT file and multiple records** - Next by Date:
**st: RE: RE: yrescale cancels yscale(range()) in graphs by a categorical variable** - Previous by thread:
**st: yrescale cancels yscale(range()) in graphs by a categorical variable** - Next by thread:
**st: RE: RE: yrescale cancels yscale(range()) in graphs by a categorical variable** - Index(es):