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

Re: st: Re: labeling overlaid histograms


From   Devra Golbe <dgolbe@optonline.net>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Re: labeling overlaid histograms
Date   Sat, 13 Dec 2003 10:42:44 -0500

Thanks to Scott and Jeff for solving the problem of labeling overlaid histograms.

Jeff suggested the following:


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)                      ///
        )
And Scott this slightly different solution:


I  use the -legend(label(# "text"))- option.  Something like
this:

twoway (histogram weight if foreign==0, density blcolor(blue) bfcolor(none)
legend(label(1 "Domestic"))) ///
 (histogram weight if foreign==1, density blcolor(red) bfcolor(none)
legend(label(2 "Foreign")))

Both work fine, but with slightly different results. Using the yvarlabel option eliminates the Y-axis label on the graph. The legend option leaves the Y-axis label in place.

*
* 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index