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

From |
"fran brittan" <franbrittan@googlemail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: Labelling stacked histograms |

Date |
Sat, 8 Nov 2008 19:38:39 +0000 |

Maarten and Martin - thank you so much! I can finally go ahead and circulate my results. Fran On Sat, Nov 8, 2008 at 1:00 PM, Martin Weiss <martin.weiss1@gmx.de> wrote: > As Maarten has told you, -la val- is necessary before Stata knows that you > want to tie a particular set of labels to a particular variable. BTW, the > submenu Data -> Labels -> Label values neatly binds all these commands > together. > > If you want to ascertain the status of a variable in this regard, try > -inspect-: > > ******* > sysuse auto, clear > ins rep > la def rep 1 "very good" 2 "good" 3 "satisfactory" 4 "not satisfactory" 5 > "plain bad" > ins rep > la val rep78 rep > ins rep > ******* > > The last line of output shows the status with regard to -label-s... > > HTH > Martin > _______________________ > ----- Original Message ----- From: "fran brittan" > <franbrittan@googlemail.com> > To: <statalist@hsphsun2.harvard.edu> > Sent: Saturday, November 08, 2008 1:42 AM > Subject: Re: st: RE: Labelling stacked histograms > > >> Thank you very much, Martin and Nick! (also for the encouragement.) >> >> I used your code to get rid of the label - I had tried the note("") >> trick before but my mistake was to write it outside the parentheses >> belonging to discrete by(var). >> >> I hope this will make my main question clearer: >> Var2 is numerical data, not string. I attached labels to the values >> using this command: >> >> label def var2 1 "value1" etc. >> >> If I type "label list", it lists the values as I defined them. >> If I just tabulate it, it shows the numerical values. I don't want to >> change the variable to string. >> >> However, the panels in the composite graph are distinguished by the >> numerical values (1, 2 etc) instead of the value labels that I >> attached to them (value1 etc). If I add a title, the same title >> appears above each panel, which continue to be marked by the numerical >> values underneath the title. I.e. the individual panel titles remain >> the numerical value. I'd like to find a way to have the respective >> value labels mark each panel, instead of the respective numerical >> values. >> >> I hope my question is clearer this time - and I very much appreciate your >> help! >> >> Fran >> >> >> On Fri, Nov 7, 2008 at 5:17 PM, Nick Cox <n.j.cox@durham.ac.uk> wrote: >>> >>> With >>> >>> . sysuse auto >>> >>> . histogram rep78, discrete by(foreign, col(1) note("")) gap(3) addl >>> normal >>> >>> I can get rid of the note you don't want -- see -note("")- -- and my >>> value labels show up automatically. >>> >>> I have to guess that your variable is not set up as you think it is with >>> value labels attached. Does >>> >>> . tab var1 >>> >>> show the labels? >>> >>> I don't understand your expectations about the legend. The legend >>> applies to the whole graph, not individual panels. The individual panel >>> titles come from the values, or value labels when attached. >>> >>> At least one of your questions took me 2 seconds to understand, but that >>> was because of previous experience and detailed study of the >>> documentation. You can't have a flexible graphics system with hundreds >>> of handles that is also instantaneously understandable. >>> >>> Nick >>> n.j.cox@durham.ac.uk >>> >>> fran brittan >>> >>> I have another question that should be very simple in theory, but I >>> couldn't work it out and neither could my colleagues. >>> >>> I want a histogram of one variable broken down by another, such as >>> education levels by gender. I'm using the histogram var1, by var2 >>> format. I want the two histograms that are produced as a result within >>> the combined graph to show the value label on top of each histogram, >>> instead of showing the numeric code. I have tested that the data has >>> the value labels I want, yet it's not showing up. I've tried >>> manipulating the legend option but it keeps giving the key to the >>> various aspects of the graphs (the density and the normal curve I >>> superimposed) rather than to the individual histograms. >>> >>> Any help would be greatly appreciated! >>> >>> My basic command is: >>> >>> histogram var1, discrete by (var2, col(1)) gap(3) addl normal >>> yscale(range(. .6)) >>> >>> In addition, the overall graph (the combined histograms) has a note in >>> the corner that reads "Graph by var2". I can't change this with the >>> title command - if I add a title, this gets inserted above each >>> histogram (the same text above each, and above the value code), while >>> the "Graph by var2" notice stays unaffected. >>> >>> This is the kind of thing that should take two seconds and just >>> devours time instead... >>> >>> * >>> * 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/ >>> >> * >> * 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/ >> > > > * > * 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/ > * * 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/

**References**:**st: Labelling stacked histograms***From:*"fran brittan" <franbrittan@googlemail.com>

**st: RE: Labelling stacked histograms***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: Labelling stacked histograms***From:*"fran brittan" <franbrittan@googlemail.com>

**Re: st: RE: Labelling stacked histograms***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**Re: st: Re: quick question about rpoisson** - Next by Date:
**st: Interval variables as independent variables** - Previous by thread:
**Re: st: RE: Labelling stacked histograms** - Next by thread:
**Re: st: Labelling stacked histograms** - Index(es):

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