Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <njcoxstata@gmail.com> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | Re: st: Bar and line graph problem |
Date | Fri, 28 Feb 2014 15:38:40 +0000 |
Sorry, but I don't understand your meaning. If the variables are on different scales and/or different units, putting them side by side might be more appropriate. A different issue, but I don't see why a -bar- graph makes sense for one variable and a -line- graph for another variable when the x variable is the same. Nick njcoxstata@gmail.com On 28 February 2014 15:32, Beatrice Crozza <beatrice.crozza@gmail.com> wrote: > Dear Nick, > > thank you very much for your reply. > > In my case what I have is that the correct bar graph is the one that > in your example you can have writing: > > twoway bar turn rep78 > > > but than when I combine it with my line graph I have something similar > to what you obtain combining the two graph. > > How can I overly the line to the bar graph, having the same bar graph > that I obtain when I do not combine the two? > > Thanks, > Bea > > 2014-02-28 15:16 GMT+00:00 Nick Cox <njcoxstata@gmail.com>: >> "the same" means "absolutely identical"? >> >> Here is a sandpit to play in: >> >> . sysuse auto >> (1978 Automobile Data) >> >> . collapse (mean) turn trunk, by(rep78) >> >> . l >> >> +---------------------------+ >> | rep78 turn trunk | >> |---------------------------| >> 1. | 1 41 8.5 | >> 2. | 2 43.375 14.625 | >> 3. | 3 41.0667 15.2667 | >> 4. | 4 38.5 13.5 | >> 5. | 5 35.6364 11.4545 | >> |---------------------------| >> 6. | . 37.6 11.4 | >> +---------------------------+ >> >> . twoway bar turn rep78 || line trunk rep78 >> >> . twoway bar turn rep78 >> >> . twoway bar turn rep78 || line trunk rep78 , ysc(r(0 .)) >> >> Please relate your discussion to that, or any other reproducible >> example of your choice. >> >> Nick >> njcoxstata@gmail.com >> >> >> On 28 February 2014 15:04, Beatrice Crozza <beatrice.crozza@gmail.com> wrote: >>> Dear All, >>> >>> I have an issue in overlying (not combining) a bar and a line graph. >>> >>> When I do them separately, everything is fine, however, when I overly >>> the line to the bar, as a result I have that all the bars become the >>> same. >>> >>> What I am doing wrong? >>> >>> This is the code: >>> twoway (bar D dow, yaxis(1) yscale(range(0))) (line amrt1 dow, sort yaxis(2)) >>> >>> Thank you very much for your help. >>> >>> Bea >>> * >>> * For searches and help try: >>> * http://www.stata.com/help.cgi?search >>> * http://www.stata.com/support/faqs/resources/statalist-faq/ >>> * http://www.ats.ucla.edu/stat/stata/ >> * >> * For searches and help try: >> * http://www.stata.com/help.cgi?search >> * http://www.stata.com/support/faqs/resources/statalist-faq/ >> * http://www.ats.ucla.edu/stat/stata/ > * > * For searches and help try: > * http://www.stata.com/help.cgi?search > * http://www.stata.com/support/faqs/resources/statalist-faq/ > * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/faqs/resources/statalist-faq/ * http://www.ats.ucla.edu/stat/stata/