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

RE: st: Labelling stacked histograms

From   "Martin Weiss" <>
To   <>
Subject   RE: st: Labelling stacked histograms
Date   Fri, 7 Nov 2008 18:31:56 +0100

Nick`s example is preferable to mine (and probably Maarten`s) as he uses the
-discrete- rep78 while we used continuous variables (whatever that may mean
with 74 observations)...


-----Original Message-----
[] On Behalf Of Maarten buis
Sent: Friday, November 07, 2008 6:26 PM
Subject: Re: st: Labelling stacked histograms

--- fran brittan <> wrote:
> 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. 

That is weird. Try the following example, which works for me:

*------- begin example ------------
sysuse auto, clear
hist mpg, by(foreign, note("") legend(off)) normal
*-------- end example -------------

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

These things should be specified _within_ the -by()- option, as is
shown in the example. The -by()- option is very powerful, but does
require some very careful reading of the documentation. I got, and
still get, bit by it many times.  

-- Maarten

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

*   For searches and help try:

*   For searches and help try:

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