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 at the end of May, and its replacement, statalist.org is already up and running.


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

RE: st: ylines with two y-axes


From   "Ivica Rubil" <irubil@eizg.hr>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: ylines with two y-axes
Date   Wed, 25 Jul 2012 14:30:07 +0200

Maarten,

when I add axis(1) and axis(2) as you suggest, Stata reports "option
axis() not allowed".
Here's the code:

twoway line gic_L p, sort yaxis(1) lcolor(red) yline(`a_mean',
lcolor(red) lpattern(dash)) axis(1)) || ///
       line gic_R p, sort yaxis(2) lcolor(blue)  yline(`g_mean',
lcolor(blue)  lpattern(dash) axis(2))

ir





--
Ivica Rubil
Ekonomski institut || The Institute of Economics, Zagreb
Trg J. F. Kennedyja 7, 10 000 Zagreb, Croatia
tel. +385-1-2362-269 || fax. +385-1-2335-165
irubil@eizg.hr || www.eizg.hr


-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten Buis
Sent: 25. srpanj 2012 14:11
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: ylines with two y-axes

On Wed, Jul 25, 2012 at 2:01 PM, Ivica Rubil wrote:
> Below is my code for a graph with two y-axes:
>
> twoway (line gic_L p, sort yaxis(1) lcolor(red) yline(`a_mean')) ||
///
>        (line gic_R p, sort yaxis(2) lcolor(blue) yline(`g_mean'))
>
> But, the trouble is that Stata gives me a graph on which both ylines
are
> associated with the same axis. So, how can I specify which yline
refers
> to which of the two y-axes?

*------------------ begin example --------------------
sysuse auto, clear
twoway scatter price mpg , yaxis(1)                ///
               yline(5000, lcolor(red) axis(1)) || ///
       scatter headroom mpg, yaxis(2)              ///
               yline(2, lcolor(blue) axis(2))
*------------------- end example ---------------------
(For more on examples I sent to the Statalist see:
http://www.maartenbuis.nl/example_faq )

Hope this helps,
Maarten

--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany


http://www.maartenbuis.nl
--------------------------
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index