Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: labeling overlaid histograms


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: labeling overlaid histograms
Date   Fri, 12 Dec 2003 20:45:44 -0600

Devra Golbe <[email protected]> asks how to label overlaid histograms:

> I am trying to  produce overlaid  histograms in which each histogram is 
> labeled (e.g., "foreign" or "domestic").  I have checked the graphics 
> manual, and the online help, and am unable to find the solution.
> 
> . use "C:\Stata8\auto.dta", clear
> .histogram weight if foreign==0, density blcolor(blue) bfcolor(none)
> 
> produces a single histogram labeled  "Weight (lbs.)"
> 
> However, the following
> 
> . twoway (histogram weight if foreign==0, density blcolor(blue) 
> bfcolor(none))  ///
>   (histogram weight if foreign==1, density blcolor(red) bfcolor(none))
> 
> produces two overlaid histograms, each labeled "density".  How can I get 
> the two histograms to be labeld "Domestic" and "Foreign", respectively?

Use the -yvarlabel()- option within each -histogram- plot-type:

	. twoway					///
	(histogram weight if foreign==0,		///
		density blcolor(blue) bfcolor(none)	///
		yvarlabel(Domestic)			///
	)						///
	(histogram weight if foreign==1,		///
		density blcolor(red) bfcolor(none)	///
		yvarlabel(Foreign)			///
	)

--Jeff
[email protected]
*
*   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/



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