Setting plot limits with dates

23 vues (au cours des 30 derniers jours)
Ziggy
Ziggy le 5 Août 2013
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!

Réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 5 Août 2013
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 commentaire
Ziggy
Ziggy le 5 Août 2013
Thanks - I have it working now.

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by