How can I plot my reflectance data according the "day of year"?

1 view (last 30 days)
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 Comment
Cris LaPierre
Cris LaPierre on 17 Jun 2022
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.

Sign in to comment.

Accepted Answer

Cris LaPierre
Cris LaPierre on 17 Jun 2022
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')
data = 129×7
-0.0011 0.0037 0.0191 0.0088 -0.0011 0.0022 0.0029 0.0010 0.0056 0.0179 0.0100 -0.0007 0.0027 0.0034 0.0027 0.0084 0.0222 0.0131 0.0039 0.0086 0.0091 -0.0026 0.0017 0.0132 0.0056 -0.0022 0.0027 0.0036 0.0001 0.0061 0.0183 0.0140 0.0095 0.0162 0.0165 0.0063 0.0073 0.0128 0.0064 -0.0009 0.0007 0.0011 0.0056 0.0074 0.0149 0.0075 -0.0010 0.0008 0.0012 0.0008 0.0062 0.0153 0.0141 0.0105 0.0101 0.0095 0.0052 0.0090 0.0185 0.0118 0.0017 0.0055 0.0059 0.0069 0.0084 0.0146 0.0072 -0.0022 0.0001 0.0005
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))
  2 Comments
Meghraj Kc
Meghraj Kc on 17 Jun 2022
I want to increase the size of marker, How can I do this ? I am geeting error while increasing the size of marker.

Sign in to comment.

More Answers (1)

Cris LaPierre
Cris LaPierre on 17 Jun 2022
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)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!