From: "Nick Cox" <[email protected]>
Reply-To: [email protected]
To: <[email protected]>
Subject: st: RE: Adding lines to multiple histograms
Date: Tue, 23 Jan 2007 00:02:52 -0000
Here is one method that is possible.
sysuse auto, clear
Suppose we want our lines at the positions of the means.
egen mean = mean(mpg), by(rep78)
A first histogram gives us an idea of how high we
want the lines to go.
twoway histogram mpg, by(rep78)
gen max = 0.2
Then superimpose a spike plot on the histograms.
twoway histogram mpg || spike max mean,
by(rep78, legend(off)) yti(Density) xti(Miles per gallon)
Nick
[email protected]
MA V
> I am drawing multiple histograms in one plot by using the "by" option.
> e.g. hist age, by(city)
> (note: I have 12 cities)
> My question is the following: is it possible to add one
> vertical line to
> each individual histogram(note that these lines have
> different values for
> different cities, i.e. for different histograms)?
> From searching in the statalist I concluded that this can be
> easily done in
> individual histograms.
> Can it also be done when one uses the "by" option? And, if
> so, how does one
> draw different lines in different histograms?
*
* 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/
_________________________________________________________________