필터 지우기
필터 지우기

Plotting timeseries data with quality control

조회 수: 3 (최근 30일)
Benju Baniya
Benju Baniya 2022년 7월 20일
답변: Abderrahim. B 2022년 7월 20일
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

답변 (1개)

Abderrahim. B
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)

카테고리

Help CenterFile Exchange에서 Time Series에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by