Setting plot limits with dates

23 次查看(过去 30 天)
Ziggy
Ziggy 2013-8-5
Hi,
I have two data sets, which have different ranges and wish to plot one below the other with the same axes limits. I have tried the following to no avail. This should be an easy fix I'm sure, but I can't figure it out.
%xlim(['31-Oct-2012' '26-April-2013']) - didn't work
%set(axes,'xlimmode',['31-Oct-2012' '26-April-2013']) - didn't work
axis([735205 735305 0 80]) - no effect at all
subplot(2,1,1), plot(rvhh1); legend('off');title('1-Month Henry Hub Realized Volatility')
subplot(2,1,2), plot(tempfts); legend('off'); title('Chicago: Ten-Year Daily Normals v Daily Mean');
Thanks for the help!

回答(1 个)

Azzi Abdelmalek
Azzi Abdelmalek 2013-8-5
Look at this example
close
x1=datenum('31-Oct-2012')
x2=datenum('26-April-2013')
x=x1:x2
y=sin(0.1*x)
plot(x,y)
xlim([x1,x2])
xticks=get(gca,'xtick');
set(gca,'xticklabel',cellstr(datestr(xticks))')

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by