Plotting timeseries data with quality control
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
Abderrahim. B
2022-7-20
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)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!