How can I plot my reflectance data according the "day of year"?
2 次查看(过去 30 天)
显示 更早的评论
I have the reflectance data from 2013 (January- Decemeber) to 2022 (January- Decemeber). I want to plot my reflectance data on the basis of "day of year" such that my x-axis should be 0 to 365 day and y-axis should be refletance data.
I have attached the excel file that contains reflectance data for seven different band. I want to plot each band with day of year.
1 个评论
Cris LaPierre
2022-6-17
There are 129 rows of data. What is your sample frequency? You say you have 10 years of data (Jan 2013 - Dec 2022), so it appears to be roughly 1x per month. However, we are only in June of 2022, so you must not have data through December of 2022 yet.
采纳的回答
Cris LaPierre
2022-6-17
Here's a first attempt. I will create a datetime vector of evenly spaced time values from 1/1/2013 - 12/31/2022. From there, I can use the day function to get 'dayofyear', and then use gscatter to plot each year of data by day of year on the same axes.
data = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1036075/Mean_Surface_REF.xlsx')
sDate = datetime(2013,1,1);
eDate = datetime(2022,12,31);
time = linspace(sDate,eDate,length(data))';
doy = day(time,"dayofyear");
gscatter(doy,data,year(time))
更多回答(1 个)
Cris LaPierre
2022-6-17
Use the following syntax:
You cannot skip an input, so if you want to use the default color and symbol, your syntax might look like this
gscatter(doy,data,year(time),[],[],12)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!