Path: news.mathworks.com!not-for-mail
From: "helper " <spamless@nospam.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Copy y-axis
Date: Thu, 8 May 2008 10:28:04 +0000 (UTC)
Organization: Timothy S. Farajian, Inc.
Lines: 38
Message-ID: <fvukjk$ent$1@fred.mathworks.com>
References: <fvug57$j74$1@fred.mathworks.com>
Reply-To: "helper " <spamless@nospam.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1210242484 15101 172.30.248.37 (8 May 2008 10:28:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 8 May 2008 10:28:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1272923
Xref: news.mathworks.com comp.soft-sys.matlab:467347


"Peter " <peter.lueckoff@wirtschaft.uni-giessen.de> wrote 
in message <fvug57$j74$1@fred.mathworks.com>...
> Hi
> 
> Is there an easy way to display the y-axis at the left and
> right side at the same time (can only chose left or right
> but not both)?
> 
> As it is for the same dataset so I thought plotyy is not 
the
> right function to use.
> 
> However, if someone can let me know how to copy all
> properties of the left hand y-axis to the right hand y-
axis
> (besides its position) maybe plotyy is the right 
function...
> 
> Thank you,
> Peter
> 
> 

The following works for this example:

% Example
x = 0:0.01:20;
y1 = 200*exp(-0.05*x).*sin(x);
y2 = 0.8*exp(-0.5*x).*sin(10*x);
[AX,H1,H2] = plotyy(x,y1,x,y2,'plot');

% Match axes ticks
ylim(AX(2),ylim(AX(1)))
set(AX(2),'ytickMode','auto')

Let me know if this doesn't work in your application.