plot a time series data

1 回表示 (過去 30 日間)
neda fathi
neda fathi 2022 年 9 月 9 日
コメント済み: Star Strider 2022 年 9 月 10 日
I have a daily observation of price for 32 years. The first column is date and the second column is price.
I want to plot all the data( every days in month) but since the data period is too long, I want to write the years in the x-axis like a picture I attached.Data is attached.

採用された回答

Star Strider
Star Strider 2022 年 9 月 9 日
Try this —
T1 = readtable('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1120695/sample.csv', 'VariableNamingRule','preserve')
T1 = 1749×2 table
Date Adj Close __________ _________ 01/02/1990 24.87 02/02/1990 24.32 05/02/1990 24.54 06/02/1990 24.69 07/02/1990 24.29 08/02/1990 23.77 09/02/1990 23.69 12/02/1990 24.38 13/02/1990 23.76 14/02/1990 22.05 15/02/1990 19.71 16/02/1990 20.78 20/02/1990 22.78 21/02/1990 23.89 22/02/1990 22.54 23/02/1990 23.69
figure
plot(T1.Date, T1.('Adj Close'))
xtickformat('MMM dd yyyy')
set(gca,'XTickLabelRotation',90)
.
  4 件のコメント
neda fathi
neda fathi 2022 年 9 月 10 日
This is perfect! Many many thanks!!!
Star Strider
Star Strider 2022 年 9 月 10 日
As always, my pleasure!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by