Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

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

Re: st: multiple y-axes

From   "Michael N. Mitchell" <>
Subject   Re: st: multiple y-axes
Date   Wed, 01 Sep 2010 20:33:28 -0700

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      -
A Visual Guide to Stata Graphics -
Stata tidbit of the week         -

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?


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

"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:
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index