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!