Plot time series of two set of data
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentario
Cris LaPierre
el 7 de Feb. de 2024
Editada: Cris LaPierre
el 7 de Feb. de 2024
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.
Respuestas (1)
Mathieu NOE
el 7 de Feb. de 2024
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 comentarios
Mathieu NOE
el 8 de Feb. de 2024
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 ?)
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!