Setting plot limits with dates
조회 수: 23 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (1개)
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))')
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!