I'm using plotyy to plot two datasets with the same x values over two different y scales. It all works perfectly, until I try to change the limits of the x-axis. (Matlab plots a lot of extra space on both sides.) Whenever I add in 'set(AX(1) xlim', the lines associated with that axis disappear and the plot appears blank.
My code:
[AX,h1,h2]=plotyy(datenum(DateVector),data1,datenum(DateVector),data2);
dateFormat = 10;
datetick(AX(1),'x',dateFormat);
datetick(AX(2),'x',dateFormat);
set(AX(1),'XLim',[1950 2013]);
set(AX(2),'xlim',[1950 2013]);
xlabel('Year')
ylabel('Data1');
ylabel('Data2');
Thanks!