Plotting timeseries data with quality control

3 visualizaciones (últimos 30 días)
Benju Baniya
Benju Baniya el 20 de Jul. de 2022
Respondida: Abderrahim. B el 20 de Jul. de 2022
I want to plot timeseries data and use different colors based on the quality control of data. In the data below, I want to use different colors to show NEE based on NEE_qc (which is quality control). For example, if NEE_fc = 1, 2 and 3, color of NEE would be red, green and blue. My code right now is:
plot(crs.TIMESTAMP, crs.NEE)
datetick('x','yy/mm/dd','keepticks');
xlim([datetime("2014-01-01") datetime("2015-12-30")])
xlabel('Date', 'fontsize',14)
ylabel('GPP', 'fontsize' , 14)
Data table looks like this:
crs =
TIMESTAMP NEE NEE_qc
20180101 -0.2 0
20180102 0.2 1
20180103 0.3 2
20180104 -0.002 3

Respuestas (1)

Abderrahim. B
Abderrahim. B el 20 de Jul. de 2022
Hi!
Below a code with 2 solutions, pick the one you believe answers your question better:
clear
close all
% Putting your dummy data ina table
crs = table([20180101 20180102 20180103 20180104].', [-0.2 0.2 0.3 -0.002].', [0 1 2 3].',...
'VariableNames', ["TIMESTAMP", "NEE" , "NEE_qc"]) ;
nee = crs.NEE ;
tstamp = crs.TIMESTAMP ;
nee_qc = crs.NEE_qc ;
% Solution 1
dl = datetime('2018-01-01', 'InputFormat','uuuu-MM-dd');
dr = datetime('2018-01-04', 'InputFormat','uuuu-MM-dd');
figure("Name", "Solution1")
scatter( dl:dr, crs.NEE, [], nee_qc, 'filled')
xlabel('Date', 'fontsize',14)
ylabel('GPP', 'fontsize' , 14)
% Solution 2
figure("Name", "Solution 2")
surf([(dl:dr).' (dl:dr).' ], [nee(:) nee(:)], [nee_qc(:) nee_qc(:)], ...
'EdgeColor', 'interp', ...
'LineWidth', 2 );
view(2)

Categorías

Más información sobre Time Series en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by