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

st: RE: combining bar graphs with common legend


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: combining bar graphs with common legend
Date   Fri, 7 Feb 2003 12:23:07 -0000

Daniel M�ller
>
> In Stata 8, I would like to have two bar graphs next to
> eachtoher with a
> common legend. However, I only manage to associate the
> legend with either
> one or with the other graph. But then the two graphs have
> unequal size. How
> can I put a legend below (optionelly to the left of) both
> graphs? So far I
> have:
>
> --------------------------begin---
> graph bar (mean) wricehh00 wricehh90 wricehh80, ///
> 	ti("Wetland rice") ///
> 	ytitle("Hectares per household") ///
> 	legend(off) ///
> 	name(wricehahh, replace) ///
> 	scheme(sj)
>
> graph bar (mean) uricehh00 uricehh90 uricehh80, ///
> 	ti("Upland rice") ///
> 	ytitle("") ///
> 	legend(stack col(1) pos(3) lab(1 "2000") label(2 "1990") lab(3
> "1980")) ///
> 	name(uricehahh, replace) /// this graph is smaller
> due to legend
> 	scheme(sj)
>
> graph combine wricehahh uricehahh, ///
> 	ycommon xcommon ///
> 	name(ricehahh, replace) ///
> 	scheme(sj)
> --------------------------end---
>

Here is a wild guess: restructure your data to
three variables

ricehh

wet or upland

year

and use the -by()- option.

Nick
[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