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!