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

From |
Finne Håkon <Hakon.Finne@sintef.no> |

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

Subject |
RE: st: blabel(group) for bar graphs |

Date |
Mon, 13 Sep 2004 14:31:01 +0200 |

I'm not entirely convinced. -graph bar headroom trunk, over(foreign) blabel(group)- produces something like this (which I should have put in my first message): Domestic ________ Domestic | | ________ | | | | | | | | Domestic | | Domestic | | ________ | | ________ | | | | | | | | | | _______________________________________________ Domestic Foreign whereas -graph hbar headroom trunk, over(foreign) blabel(group)- produces something like this (except that it is laid out horizontally): Foreign ________ Foreign | | ________ | | | | | | | | Foreign | | Foreign | | ________ | | ________ | | | | | | | | | | _______________________________________________ Domestic Foreign Yes, individual bars are labeled (which is my deserved punishment), so this way of labeling stacked bars with their group name will not work (the label will appear twice). But no, the actual labels do not make sense as long as there is more than one y variable to deal with. I would have expected D-D-F-F instead of D-D-D-D with -bar- and F-F-F-F with -hbar-. In the case of one y variable, -graph [h]bar headroom, over(foreign) blabel(group)- it works out fine. -- Håkon -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox Sent: 13. september 2004 13:45 To: statalist@hsphsun2.harvard.edu Subject: RE: st: blabel(group) for bar graphs On -blabel()-: try the principle that your punishment is that you got precisely what you asked for. That is, -blabel()- labels _individual_ bars. You want to label groups of bars. The presumption in -graph bar- appears to be that the natural place to do that is via text outside the category axis, and on the whole I agree with that presumption. More importantly, -graph bar- does not offer a kind of group label option, which appears to be what you want. Nick n.j.cox@durham.ac.uk > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Finne Håkon > Sent: 13 September 2004 12:11 > To: statalist@hsphsun2.harvard.edu > Subject: RE: st: blabel(group) for bar graphs > > > Thanks, Nick - > > it's amazing what the trained eye can do with Stata's > graphing capabilities and your solution responds precisely to > the way I formulated the question for vertical bar charts. > With a little tweaking, I can even accommodate it for > stacking the bars in many cases and orient the bars > horizontally (which was my original point of departure). > Nevertheless, the -blabel(group)- behavior when more than one > yvar is involved still strikes me as odd. > > -- Håkon > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu > [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox > Sent: 13. september 2004 11:51 > To: statalist@hsphsun2.harvard.edu > Subject: RE: st: blabel(group) for bar graphs > > > If -graph bar- doesn't show the flexibility you want > one option is to knit your own with -twoway bar-. > > Here is a long way round: > > collapse (mean) headroom trunk, by(foreign) > gen foreign1 = foreign - 0.1 > gen foreign2 = foreign + 0.1 > gen max = max(headroom, trunk) > twoway bar headroom foreign1 , barwidth(0.2) > || bar trunk foreign2 , barwidth(0.2) > || scatter max foreign , ms(none) mlabel(foreign) > mlabpos(12) xla(none) > > Nick > n.j.cox@durham.ac.uk > > Håkon Finne > > > Thanks for the suggestion, Phil; but no; I actually want the > > group name and not the variable name (because I later want to > > remove the label on the category axis due to space > > considerations). The problem is that the group label is > > incorrect once there is more than one yvar. > > Philip Ryan > > > By specifying -blabel(group)- you have asked Stata to label > > the bars with > > the value labels of the first (and in your case, only) > > over() variable, > > that is, foreign. > > > > Specifying -blabel(name)- will get you closer to what I think > > you want. > > > > see help graph -- bar --blabel_options > > Håkon Finne > > > the admittedly nonsensical example below, > > > > sysuse auto, clear > > graph bar headroom trunk, over(foreign) blabel(group) > > > > will produce bar labels inconsistent with labels on the > > category axis. > > What have I done to make all cars domestic? > > > > One should also think it possible to reproduce this behavior with > > > > graph hbar headroom trunk, over(foreign) blabel(group) > > > > and yet another surprise -- have I suddenly moved abroad? > > > > * > * 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/ > > * > * 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/ > * * 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/ * * 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/

- Prev by Date:
**Re: st: 2SLS with Probit in the first-stage regression** - Next by Date:
**st: RE: dmexogxt questions** - Previous by thread:
**RE: st: blabel(group) for bar graphs** - Next by thread:
**RE: st: blabel(group) for bar graphs** - Index(es):

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