DOES ANYONE KNOW WHY NOT ALL THE DATA APPEAR IN THE GRAPH?

3 visualizzazioni (ultimi 30 giorni)
Hello everyone,
when I go to plot the average with different colors ,not all the data appear in the graph.
As you can see in the attached image, I only get some data (but not all data) which are present in the matrix (in the blue circle should be the data that don't appear)
While if I go to plot just the average, I get all the data in the graph.
This happens just when I plot the data with different colors, not when I simply plot the data ("% Plot Average).
%PLOT average with different colors for each bar
load('giulia_sd_med_rialz_7.mat')
errorbar(giulia_daily.Time(1:4471,1),giulia_sd.Var8(1:4471,1),giulia_sd.Var7(1:4471,1),'.r','MarkerSize',6)
errorbar(giulia_daily.Time(4471:4779,1),giulia_sd.Var8(4471:4779,1),giulia_sd.Var7(4471:4779,1),'.b','MarkerSize',6)
errorbar(giulia_daily.Time(4779:7722,1),giulia_sd.Var8(4779:7722,1),giulia_sd.Var7(4779:7722,1),'.r','MarkerSize',6)
hold on
plot(giulia_daily.Time(:,1),[B, giulia_sd.Var8(:,1)]);
xlabel('Time');
ylabel('Height(cm)');
title('Giulia');
Does anyone know how to solve this problem?
Thank you.
  5 Commenti

Accedi per commentare.

Risposte (2)

Sulaymon Eshkabilov
Sulaymon Eshkabilov il 9 Giu 2021
Because there are many "nan" points in giulia_daily and therefore, your plots have many missing points.

Walter Roberson
Walter Roberson il 11 Giu 2021
You do a lot of filtering of spikes. How would we know which data is "missing" compared to which data you deliberately set to nan?
Your code to get rid of the spikes is not sustainable. I attach a rewritten version of it.
load('giulia_TT.mat')
load('giulia_sd_med_rialz_7.mat')
giulia_daily=retime(giulia_TT,'daily','mean');
%MEDIANA_FILTER
Mediana_Filter = medfilt1(giulia_daily.Var5(:,1),7);
% PLOT_MEDIAN_FILTER
plot(giulia_daily.Time(:,1),[giulia_daily.Var5(:,1) Mediana_Filter]);
med=Mediana_Filter;
% FILTER_SPIKES
zaps = [
1 1100 50 %
1 7722 160 %
843 852 42 %
1206 1241 45 %
1250 1470 100 %
1676 1685 48 %
2268 2726 80 %
2437 2444 70 %
2846 2944 95 %
2850 2991 105 %
3056 3590 107 %
3328 3422 105 %
3936 4130 75 %
4204 4224 50 %
4204 4295 81 %
4818 5259 100 %
4880 5035 95 %
5665 5710 130 %
5705 5713 130 %
5919 5955 25 %
6408 6680 55 %
6872 6970 75 %
6874 6985 50]; %
nmed = length(med);
I = (1 : nmed).';
mask = false(nmed,1);
for K = 1 : size(zaps,1)
mask = mask | (ismember(I, zaps(K,1):zaps(K,2)) & med >= zaps(K,3));
end
med(mask) = nan;
plot(giulia_daily.Time(:,1),[giulia_daily.Var5(:,1) med]);
A=med;
for i =3639:7722
A(i)=A(i)+40;
end
plot(giulia_daily.Time(:,1),[giulia_daily.Var5(:,1) A]);
B=A;
for i =5874:7722
B(i)=B(i)+115;
end
plot(giulia_daily.Time(:,1),[giulia_daily.Var5(:,1) B]);
%PLOT average
load('giulia_sd_med_rialz_7.mat')
errorbar(giulia_daily.Time(:,1),giulia_sd.Var8(:,1),giulia_sd.Var7(:,1),'.r','MarkerSize',6)
hold on
plot(giulia_daily.Time(:,1),[B, giulia_sd.Var8(:,1)]);
xlabel('Time');
ylabel('Height(cm)');
title('Giulia')
%PLOT average with different colors for each bar
load('giulia_sd_med_rialz_7.mat')
errorbar(giulia_daily.Time(1:4471,1),giulia_sd.Var8(1:4471,1),giulia_sd.Var7(1:4471,1),'.r','MarkerSize',6)
errorbar(giulia_daily.Time(4471:4779,1),giulia_sd.Var8(4471:4779,1),giulia_sd.Var7(4471:4779,1),'.b','MarkerSize',6)
errorbar(giulia_daily.Time(4779:7722,1),giulia_sd.Var8(4779:7722,1),giulia_sd.Var7(4779:7722,1),'.r','MarkerSize',6)
hold on
plot(giulia_daily.Time(:,1),[B, giulia_sd.Var8(:,1)]);
xlabel('Time');
ylabel('Height(cm)');
title('Giulia');

Categorie

Scopri di più su Discrete Data Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by