How to set start & end dates from my time series as limits of my x-axis

3 ビュー (過去 30 日間)
Isma
Isma 2015 年 4 月 22 日
コメント済み: Isma 2015 年 4 月 22 日
hi
when i plot my series, the chart starts with a date and ends with another which are not held in my raw data thus creating empty spaces on the chart.
to clarify: the start date from my data is 3/3/2003 and ends at 1/26/2015. however from my below script , matlab outputs a chart starting on 01-01-2000 ending on 01-01-2020 for some reasons. Hence blank spaces are displayed on the chart from 01-01-2000 to 3-3-2003 and from 1-26-2015 to 01-01-2020.
for curiousity does someone know why matlab adds automatically 01-01-2000 && 01-01-2020 to the chart? is there a way of limiting the x-axis to my time series date so as to improve the quality of the chart? i've already tried
axis([-10 10 0 inf])
without any improvement. cheers
%ABRXEUR
t_=x(:,1);
t_x=cellfun(@datenum,x(:,1));
px_=x(:,2);
px_x=cell2mat(x(:,2));
rt_=x(:,3);
rt_x=cell2mat(x(:,3));
subplot(2,2,1);
plot(t_x,px_x),datetick('x','dd/mm/yyyy'),xlabel('date'),ylabel('price'),title('x');
subplot(2,2,2);
plot(t_x,rt_x),datetick('x','dd/mm/yyyy'),xlabel('date'),ylabel('return'),title('y');

採用された回答

Guillaume
Guillaume 2015 年 4 月 22 日
Have you tried?
axis tight
  1 件のコメント
Isma
Isma 2015 年 4 月 22 日
Cheers Guillaume, it does improve the chart's quality. the main drawback as far as i am concerned: it removes any date from the x-axis. Thus do you have any idea on the way to divide the x-axis into few segments and see them displayed in the chart?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBar Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by