matlab - Setting x-axis limits using plotyy; data disappears -


i'm using plotyy plot 2 datasets same x values on 2 different y scales. works perfectly, until try change limits of x-axis. (matlab plots lot of space on both sides.) whenever add in 'set(ax(1) xlim', lines associated axis disappear , 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!

try instead.

set(ax(1),'xlim',[datenum(1950,1,1) datenum(2013,1,1)]);   set(ax(2),'xlim',[datenum(1950,1,1) datenum(2013,1,1)]);  

since x-axis date (years), limits have specified in datenum format too.

also, need give axis handle label functions too.

ylabel(ax(1),'data1');   ylabel(ax(2),'data2'); 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -