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))')
  댓글 수: 1
Ziggy
Ziggy 2013년 8월 5일
Thanks - I have it working now.

댓글을 달려면 로그인하십시오.

카테고리

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