[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: -graph bar, over()- question and bug report |

Date |
Wed, 13 Aug 2003 13:39:11 +0100 |

Friedrich Huebler > How can I emphasize some of the groups in a -graph bar, over()- > graph? I have graphs similar to one produced with these commands: > > . sysuse uslifeexp > . drop if year>1910 > . graph bar le_w le_b, over(year) stack > > Let's assume I want to emphasize the years 1902 to 1905. As far as I > know, none of the following ideas can be implemented in Stata. > > - Draw the labels for 1902 to 1905 in a different color. > This idea is > my personal favorite but -relabel(# "text")- has no option for > specifying the color of the text. > - Add a horizontal line from 1902 to 1905 (horizontal y lines cross > the entire graph). > - Add two vertical lines, one to the left of 1902 and one to the > right of 1905 (vertical lines cannot be added). > > I would appreciate any suggestions for adding emphasis to the years > 1902 to 1905. > > Now to the bug report. I thought about creating a vertical line with > the letters I or l but this leads to an error message. > > . graph bar le_w le_b, over(year) stack text(2 18 "I" 2 55 "I") > invalid syntax > r(198); > > The same error message appears when the letters i, j, or l are used. > That resulting graph has only the bars without any labels. I did not > test the entire alphabet but most other letters appear to > work. I can > create a vertical line with the character used to indicate "or" in > Stata commands but I would rather not use the -text- option because > the correct coordinates depend on things like legend position and > size that are not fixed. I confirm the last bug report. I get seven "invalid syntax" messages; that's a touch of class for you. In general terms, some of what Friedrich is seeing follows from a division mentioned several times on this list since the release of Stata 8. -graph bar- is based on the idea of bars plotted on a categorical axis, in contrast to -twoway bar-, which is based on bars plotted on a numeric axis. I was going to suggest moving to -twoway bar- as a partial remedy, but Friedrich wants to -stack- bars, and I would think that's going to be difficult with -twoway bar- (I won't say impossible, just in case it can be done). However, that in turn raises the question of why you want to stack these bars. I assert that stacking is permissible for additive quantities, and I would say that life expectancy for whites and blacks does not qualify. So are these just data to illustrate the Stata graphics problem, or is this what you want to do? 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/

**Follow-Ups**:**st: Bootstrap***From:*"Joao Pedro W. de Azevedo" <j.p.azevedo@ncl.ac.uk>

**st: Re: -graph bar, over()- question and bug report***From:*Friedrich Huebler <huebler@rocketmail.com>

**References**:**st: -graph bar, over()- question and bug report***From:*Friedrich Huebler <huebler@rocketmail.com>

- Prev by Date:
**Re: st: generating categorical variables** - Next by Date:
**st: Re: -graph bar, over()- question and bug report** - Previous by thread:
**st: -graph bar, over()- question and bug report** - Next by thread:
**st: Re: -graph bar, over()- question and bug report** - Index(es):

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