Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: plotyy problem with shifted x axis
Date: Tue, 22 Mar 2011 18:29:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <imapph$5g3$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1300818545 5635 172.30.248.46 (22 Mar 2011 18:29:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 22 Mar 2011 18:29:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2680817
Xref: news.mathworks.com comp.soft-sys.matlab:717444

Hello I have troubles with plotyy

I have data in matrix M1 in format f.e.:
2011 01 01 13 56 00 20 20 125 136 0.18 65
first six rows are date time the next are traffic data...
I am computing final 
 TimeAxe = datenum(M1(:,1),M1(:,2),M1(:,3),M1(:,4),M1(:,5),M1(:,6));
  plotyy(TimeAxe, M1(:,7), TimeAxe, M1(:,8));
grid;datetick('x',15);

but 1st and second lines are shifted to itself. this is visible on this image
http://tinypic.com/r/2ahe9sh/7

when I delete datetick, graph is normal, can please tell me why is this done and help me to remove shift? I tried 

  [AX,Int,Spd] = plotyy(TimeAxe, M1(:,7),TimeAxe, M1(:,8),'plot');  
         set(get(AX(1),'Ylabel'),'String','Intenzita VJ/km');
         set(get(AX(2),'Ylabel'),'String','Rychlost km/h');
         xlim(AX(2),[min(TimeAxe),max(TimeAxe)])
         linkaxes(AX,'x')

        set(Int,'LineStyle','.','Color','c');datetick('x',15);
        set(Spd,'LineStyle','.','Color','m');datetick('x',15);

but without any success.

Thank you for your help. Martin
P.S. is it possible to set min and max on y axes? sth like using axes(xmin,xmax,ymin,ymax)???
thank you once again for quick answer. Martin