Path: news.mathworks.com!not-for-mail
From: "Anh Huy Phan" <phananhhuy@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: plotyy&annotating
Date: Sat, 19 Apr 2008 15:20:03 +0000 (UTC)
Organization: Broadcast &#38; Research Apps
Lines: 37
Message-ID: <fud2j3$8t1$1@fred.mathworks.com>
References: <fuc9ie$qp7$1@fred.mathworks.com>
Reply-To: "Anh Huy Phan" <phananhhuy@mathworks.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 1208618403 9121 172.30.248.37 (19 Apr 2008 15:20:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 19 Apr 2008 15:20:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 113206
Xref: news.mathworks.com comp.soft-sys.matlab:464031


"Wu Zhiyong" <wuzhiyong_163@163.com> wrote in message
<fuc9ie$qp7$1@fred.mathworks.com>...
> well,the data are as followed:
> [x,y1],[x,y2],[x,y3];
> I want to plot three lines. plot y1,y2 for the left 
> axes,and plot y3 for the right axes.
> It seams that we can just plot 2 lines with the 
> function "plotyy".
> I add another "plot",but I failed to annotate the figure.
> my code are as followed:
> 
> [Ax,H1,H2]=plotyy(x,y1,x,y3);
> hold on
> H3=plot(x,y2);
> set(gca,'XTick',[0 3 6 9 12 15 18],'XTicklabel',[08 11 14 
> 17 20 23 02]) 
> legend('modis','usgs','diff')
> 
> I can't get the right legend and XTicklabel.
> 
> Do you have any good ideal?
> any suggestion is appreciated!
> Thanks!
> 


Something likes this
[Ax,H1,H2]=plotyy(x,[y1;y2],x,y3);
legend([H1;H2],{'modis','usgs','diff'})
set(Ax(1),'XTick',[0 3 6 9 12 15 18],'XTicklabel',[08 11 14 
17 20 23 02])
set(Ax(1),'XTick',[])


Anh Huy Phan
BSI - RIKEN