...
I'm trying to overlay a line graph and a histogram, so I used this: twoway (line hr TOC, yaxis(1)) /// (histogram osteocalcin, width(5) yaxis(2)) This gives me the y-axis for hr on the left and the y-axis for the histogram on the right which is what I want, but the histogram is over the top of the line. OK, so then I tried: twoway (histogram osteocalcin, width(5) yaxis(2)) /// (line hr TOC, yaxis(1)) Now the line is on top of the histogram (good), but the y-axes have swapped. Now the hr axis is on the right and the histogram axis is on the left. So my question: how can if get my axes where I want them and have the line over the top of the histogram? Thanks. ______________________________________________ Kieran McCaul MPH PhD WA Centre for Health & Ageing (M573) University of Western Australia Level 6, Ainslie House 48 Murray St Perth 6000 Phone: (08) 9224-2701 Fax: (08) 9224 8009 email: [hidden email] http://myprofile.cos.com/mccaul http://www.researcherid.com/rid/B-8751-2008 "You don't win friends with salad" - Homer Simpson on vegetarianism ________________________________________________________________________ __ IMPORTANT: This email is intended for the use of the individual addressee(s) named above and may contain information that is confidential, privileged or unsuitable for overly sensitive persons with low self-esteem, no sense of humour or irrational religious beliefs. If you are not the intended recipient, any dissemination, distribution or copying of this email is not authorised (either explicitly or implicitly) and constitutes an irritating social faux pas. * * 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/ |
Maybe this will do the trick?
twoway (histogram osteocalcin, width(5) yaxis(1)) /// (line hr TOC, yaxis(2)) Michael N. Mitchell Data Management Using Stata - http://www.stata.com/bookstore/dmus.html A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html Stata tidbit of the week - http://www.MichaelNormanMitchell.com On 2010-09-01 7.53 PM, Kieran McCaul wrote: > ... > > I'm trying to overlay a line graph and a histogram, so I used this: > > twoway (line hr TOC, yaxis(1)) /// > (histogram osteocalcin, width(5) yaxis(2)) > > This gives me the y-axis for hr on the left and the y-axis for the > histogram on the right which is what I want, but the histogram is over > the top of the line. > > OK, so then I tried: > twoway (histogram osteocalcin, width(5) yaxis(2)) /// > (line hr TOC, yaxis(1)) > > Now the line is on top of the histogram (good), but the y-axes have > swapped. Now the hr axis is on the right and the histogram axis is on > the left. > > So my question: how can if get my axes where I want them and have the > line over the top of the histogram? > > Thanks. > > > > ______________________________________________ > Kieran McCaul MPH PhD > WA Centre for Health& Ageing (M573) > University of Western Australia > Level 6, Ainslie House > 48 Murray St > Perth 6000 > Phone: (08) 9224-2701 > Fax: (08) 9224 8009 > email: [hidden email] > http://myprofile.cos.com/mccaul > http://www.researcherid.com/rid/B-8751-2008 > > "You don't win friends with salad" - Homer Simpson on vegetarianism > ________________________________________________________________________ > __ > IMPORTANT: This email is intended for the use of the individual > addressee(s) named above and may > contain information that is confidential, privileged or unsuitable for > overly sensitive persons with low > self-esteem, no sense of humour or irrational religious beliefs. If you > are not the intended recipient, > any dissemination, distribution or copying of this email is not > authorised (either explicitly or implicitly) > and constitutes an irritating social faux pas. > > > * > * 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/ * 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/ |
...
No joy there, Michael. twoway (histogram osteocalcin, width(5) yaxis(1)) /// (line hr TOC, yaxis(2)) gives me the same as: twoway (histogram osteocalcin, width(5) yaxis(2)) /// (line hr TOC, yaxis(1)) -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Michael N. Mitchell Sent: Thursday, 2 September 2010 11:33 AM To: [hidden email] Subject: Re: st: multiple y-axes Maybe this will do the trick? twoway (histogram osteocalcin, width(5) yaxis(1)) /// (line hr TOC, yaxis(2)) Michael N. Mitchell Data Management Using Stata - http://www.stata.com/bookstore/dmus.html A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html Stata tidbit of the week - http://www.MichaelNormanMitchell.com On 2010-09-01 7.53 PM, Kieran McCaul wrote: > ... > > I'm trying to overlay a line graph and a histogram, so I used this: > > twoway (line hr TOC, yaxis(1)) /// > (histogram osteocalcin, width(5) yaxis(2)) > > This gives me the y-axis for hr on the left and the y-axis for the > histogram on the right which is what I want, but the histogram is over > the top of the line. > > OK, so then I tried: > twoway (histogram osteocalcin, width(5) yaxis(2)) /// > (line hr TOC, yaxis(1)) > > Now the line is on top of the histogram (good), but the y-axes have > swapped. Now the hr axis is on the right and the histogram axis is > the left. > > So my question: how can if get my axes where I want them and have the > line over the top of the histogram? > > Thanks. > > > > ______________________________________________ > Kieran McCaul MPH PhD > WA Centre for Health& Ageing (M573) > University of Western Australia > Level 6, Ainslie House > 48 Murray St > Perth 6000 > Phone: (08) 9224-2701 > Fax: (08) 9224 8009 > email: [hidden email] > http://myprofile.cos.com/mccaul > http://www.researcherid.com/rid/B-8751-2008 > > "You don't win friends with salad" - Homer Simpson on vegetarianism > > __ > IMPORTANT: This email is intended for the use of the individual > addressee(s) named above and may > contain information that is confidential, privileged or unsuitable for > overly sensitive persons with low > self-esteem, no sense of humour or irrational religious beliefs. If you > are not the intended recipient, > any dissemination, distribution or copying of this email is not > authorised (either explicitly or implicitly) > and constitutes an irritating social faux pas. > > > * > * 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/ * 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/ * * 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/ |
Well, that is what happens when you suggest an idea without trying it. I am stumped on
this, because the documentation says -yscale(alt)- should switch the position of the y axis from right to left (or vice versa), but I cannot find any combination of -yaxis()- and -yscale()- that will solve this. Although this is not a fun suggestion, you could use the graph editor, choosing the -grid edit- mode to move the axis from the left to the right, and then from the right to the left. I bet, however, someone else has a better idea! Michael N. Mitchell Data Management Using Stata - http://www.stata.com/bookstore/dmus.html A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html Stata tidbit of the week - http://www.MichaelNormanMitchell.com On 2010-09-01 8.39 PM, Kieran McCaul wrote: > ... > > No joy there, Michael. > > twoway (histogram osteocalcin, width(5) yaxis(1)) /// > (line hr TOC, yaxis(2)) > > gives me the same as: > > twoway (histogram osteocalcin, width(5) yaxis(2)) /// > (line hr TOC, yaxis(1)) > > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Michael N. > Mitchell > Sent: Thursday, 2 September 2010 11:33 AM > To: [hidden email] > Subject: Re: st: multiple y-axes > > Maybe this will do the trick? > > twoway (histogram osteocalcin, width(5) yaxis(1)) /// > (line hr TOC, yaxis(2)) > > > Michael N. Mitchell > Data Management Using Stata - > http://www.stata.com/bookstore/dmus.html > A Visual Guide to Stata Graphics - > http://www.stata.com/bookstore/vgsg.html > Stata tidbit of the week - http://www.MichaelNormanMitchell.com > > > > On 2010-09-01 7.53 PM, Kieran McCaul wrote: >> ... >> >> I'm trying to overlay a line graph and a histogram, so I used this: >> >> twoway (line hr TOC, yaxis(1)) /// >> (histogram osteocalcin, width(5) yaxis(2)) >> >> This gives me the y-axis for hr on the left and the y-axis for the >> histogram on the right which is what I want, but the histogram is over >> the top of the line. >> >> OK, so then I tried: >> twoway (histogram osteocalcin, width(5) yaxis(2)) /// >> (line hr TOC, yaxis(1)) >> >> Now the line is on top of the histogram (good), but the y-axes have >> swapped. Now the hr axis is on the right and the histogram axis is > on >> the left. >> >> So my question: how can if get my axes where I want them and have the >> line over the top of the histogram? >> >> Thanks. >> >> >> >> ______________________________________________ >> Kieran McCaul MPH PhD >> WA Centre for Health& Ageing (M573) >> University of Western Australia >> Level 6, Ainslie House >> 48 Murray St >> Perth 6000 >> Phone: (08) 9224-2701 >> Fax: (08) 9224 8009 >> email: [hidden email] >> http://myprofile.cos.com/mccaul >> http://www.researcherid.com/rid/B-8751-2008 >> >> "You don't win friends with salad" - Homer Simpson on vegetarianism >> > ________________________________________________________________________ >> __ >> IMPORTANT: This email is intended for the use of the individual >> addressee(s) named above and may >> contain information that is confidential, privileged or unsuitable for >> overly sensitive persons with low >> self-esteem, no sense of humour or irrational religious beliefs. If > you >> are not the intended recipient, >> any dissemination, distribution or copying of this email is not >> authorised (either explicitly or implicitly) >> and constitutes an irritating social faux pas. >> >> >> * >> * 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/ > * > * 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/ > > * > * 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/ * 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/ |
sysuse auto
twowy hist mpg, yscale(alt axis(1)) || line weight mpg, sort yaxis(2) yscale(alt axis(2)) Scott On Wed, Sep 1, 2010 at 11:54 PM, Michael N. Mitchell <[hidden email]> wrote: > Well, that is what happens when you suggest an idea without trying it. I am > stumped on this, because the documentation says -yscale(alt)- should switch > the position of the y axis from right to left (or vice versa), but I cannot > find any combination of -yaxis()- and -yscale()- that will solve this. > Although this is not a fun suggestion, you could use the graph editor, > choosing the -grid edit- mode to move the axis from the left to the right, > and then from the right to the left. I bet, however, someone else has a > better idea! > > Michael N. Mitchell > Data Management Using Stata - http://www.stata.com/bookstore/dmus.html > A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html > Stata tidbit of the week - http://www.MichaelNormanMitchell.com > > > * * 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/ |
Scott Merryman wrote:
> sysuse auto > twowy hist mpg, yscale(alt axis(1)) || line weight mpg, sort yaxis(2) > yscale(alt axis(2)) But do you notice that the line graph it produces looks horrible, even with -sort-? -- Clive Nicholas [Please DO NOT mail me personally here, but at <[hidden email]>. Please respond to contributions I make in a list thread here. Thanks!] "My colleagues in the social sciences talk a great deal about methodology. I prefer to call it style." -- Freeman J. Dyson * * 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/ |
In reply to this post by Scott Merryman
...
thanks Scott, that did th etrick -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Scott Merryman Sent: Thursday, 2 September 2010 8:05 PM To: [hidden email] Subject: Re: st: multiple y-axes sysuse auto twowy hist mpg, yscale(alt axis(1)) || line weight mpg, sort yaxis(2) yscale(alt axis(2)) Scott On Wed, Sep 1, 2010 at 11:54 PM, Michael N. Mitchell <[hidden email]> wrote: > Well, that is what happens when you suggest an idea without trying it. I am > stumped on this, because the documentation says -yscale(alt)- should switch > the position of the y axis from right to left (or vice versa), but I cannot > find any combination of -yaxis()- and -yscale()- that will solve this. > Although this is not a fun suggestion, you could use the graph editor, > choosing the -grid edit- mode to move the axis from the left to the right, > and then from the right to the left. I bet, however, someone else has a > better idea! > > Michael N. Mitchell > Data Management Using Stata - http://www.stata.com/bookstore/dmus.html > A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html > Stata tidbit of the week - http://www.MichaelNormanMitchell.com > > > * * 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/ * * 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/ |
Powered by Nabble | Edit this page |