Plot time series of two set of data
7 ビュー (過去 30 日間)
古いコメントを表示
The attached is two set of data with different size, 'ARMOR', and 'HadGEM2', respectively. I would be grateful if someone could help me to plot the time series of these two sets of data on one frame, so that the x-axis specifies the time based on the year or year and month and the y-axis value of object 'temperature'. Thanks
1 件のコメント
Cris LaPierre
2024 年 2 月 7 日
編集済み: Cris LaPierre
2024 年 2 月 7 日
Your variables are timeseries, so you should just be able to plot them.
load ARMOR_anomaly.mat
Armor
plot(Armor)
It sounds like you are saying that time data incorporated into your time series is incorrect?
Armor.Time
There is a separate time timeseries in your mat file as well. Since Time there is also just index number, I assume we should look at Data instead.
time.Data
Perhaps you can help us out by explaining how you created time.Data? Or where it was captured from? Is it perhaps posixtime?
datetime(time.Data,'ConvertFrom','posixtime')
You should probably either correct your timeseries variables so the correct time and data are in a single series, or not use the timeseries data type at all.
回答 (1 件)
Mathieu NOE
2024 年 2 月 7 日
hello
I started this , but I am unsure about how the dates / time is coded in your data (as I discovered , HadGEM2 has to do with Mid-Pliocene era so this is certainly not what I have now :
load('ARMOR_anomaly.mat')
xdate1 = datetime(datevec(time.Data))
data1 = (Armor.Data);
figure(1),plot(xdate1,data1,'-*',"DatetimeTickFormat","yyyy-MM");
load('HadGEM2_anomaly.mat')
xdate2 = datetime(datevec(time.Data))
data2 = (HadGEM2.Data);
figure(2),plot(xdate2,data2,'-*',"DatetimeTickFormat","yyyy-MM");
2 件のコメント
Mathieu NOE
2024 年 2 月 8 日
I don't understand how your time data is formated
you can always for ce the time axis to match your range
your two data sets do have different length - do they both cover the same range , or is only the longest one covering the 1993 to 2021 range (and they would have the same time spacing ?)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!