[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> |

Subject |
st: RE: xlabels and graph with 2 y-axis |

Date |
Thu, 21 Aug 2003 15:48:11 +0100 |

Dr Veit Grote > I have a simple graph that does not come out as I want to > (Stata 8.1). > I have a labeled categorical variable which I would like to > use as my x-axis, and two numerical variables of different > scales (2 y-axis). One should be expressed in bars and one > as a line/connected line (as in the frequency polygon > example in Statalist just recently). > > 1. First problem: Why is the scale of the bars cut (in my > data at 30, so that the lower range 0-30 is not displayed) > whereas the scale of the 2nd y-axis is for the whole range > of the data? OK, I fixed that with options scale/range. Not sure what kind of answer you want. It's just the way it's implemented. Evidently one design would ensure that by default all bars in -twoway bar- start at 0, but that would be awkward. Put it whimsically: the graph's primary identity is as a -twoway- graph, and only secondarily is it a -bar- graph. The rule for -twoway-'s default is _not_ to insist on starting axes at 0. That's what takes precedence here. At least, that's my interpretation. Admittedly, the rule causes puzzles at times. I have been caught a few times wondering why some of my bars had disappeared and searched for my bug as an explanation. This happened when I was developing -eqprhistogram-, which is really a wrapper for -twoway bar-. After having worked out what was going on, with an excellent assist from Vince Wiggins, I wired in -yscale(range(0))- as a default. > 2. Second problem: I am unable to display the labels of the > x-axis? What is the trick? One desperate try was: > > twoway bar y1 x || connected y2 x, xlabel(#7, valuelabels) yaxis(2) I got the value labels to appear when I insisted -legend(off)-. Can't explain that one at all. Nick n.j.cox@durham.ac.uk * * 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/

**References**:**st: xlabels and graph with 2 y-axis***From:*"Grote, Veit Dr." <Veit.Grote@kk-i.med.uni-muenchen.de>

- Prev by Date:
**st: Fisher's LSD and oneway ANOVA in Stata** - Next by Date:
**st: RE: Fisher's LSD and oneway ANOVA in Stata** - Previous by thread:
**st: xlabels and graph with 2 y-axis** - Next by thread:
**st: Re: xlabels and graph with 2 y-axis** - Index(es):

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