Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Devra Golbe <dgolbe@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: RE: "overlaying" Stacked bar charts |
Date | Thu, 18 Feb 2010 22:15:08 -0500 |
Devra ************************** webuse citytemp, clear collapse (mean) heat cool tempja tempju, by(region) expandcl 2, cluster(region) gener(reg2) forvalues n = 1(2)7 { replace tempjan=. if reg2==`n' replace tempjuly=. if reg2==`n'} forvalues n = 2(2)8 {
replace heatdd=. if reg2==`n' replace cooldd=. if reg2==`n'} label define reglbl 1 "NE" 2 "NE" 3 "N Central" 4 "N Central" 5 "South" 6 "South" 7 "West" 8 "West" label values reg2 reglbl graph bar tempjan tempjuly heatdd cooldd, over(reg2) stack ************************
on 2/17/2010 2:06 PM Nick Cox said:
-graph bar- does not permit overlay. That is a -twoway- concept. Thatyou know.If you attempted to translate -graph bar- into an equivalent -twoway- statement, you would need to do more work. For example, stacking bars calls for -twoway rbar- rather than -twoway bar- and you still need to do more work to specify the cumulated coordinates. And -twoway bar- doesnot permit -over()-, as indicated.I'd imagine you're better off staying with -graph bar-. But if I understand you correctly you'd need to -reshape- or -stack- your data so that you could then call -graph bar- with two separate -over()- options.Nick n.j.cox@durham.ac.ukDevra GolbeIs there a way to "overlay" stacked bar charts? That is, using the citytemp data I can gowebuse citytemp graph bar tempjan tempjuly, over(region) stack graph bar heatdd cooldd, over(region) stackand get two separate graphs each over region. What I would like is one graph, with the temp bar for each region paired with the corresponding degree-day bar. I guessed the code would be something like the following pseudo-code, which results in an error:twoway (bar tempjan tempjuly ) (bar heatdd cooldd ), over(region) stack option over() not allowed r(198);
* * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/