Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: multiple y-axes


From   "Michael N. Mitchell" <[email protected]>
To   [email protected]
Subject   Re: st: multiple y-axes
Date   Wed, 01 Sep 2010 21:54:37 -0700

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: [email protected]
[mailto:[email protected]] On Behalf Of Michael N.
Mitchell
Sent: Thursday, 2 September 2010 11:33 AM
To: [email protected]
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: [email protected]
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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index