Why does pcolor adds a flat lines during a data gap instead of white space?

6 visualizaciones (últimos 30 días)
I use pcolor command to make a color plot. The data has a some gaps (NaN values) in it where a white space is expected.
However, I get flat horizontal lines during that period. Any help appreciated. I tried both shading flat and shading interp, it shows same. However, I do see actual white space at certain instants. I could not figure out why! I attach an example for each case below. Both occurs in the same plot.
EDITS: Data Attached
h_fig = pcolor(T_,E_log,(double(FPDO))');
% h_fig.EdgeColor = 'none';
xlim([0,T_(end,1)]); ylim([-2.5,log10(30)]);
colormap(jet); shading interp;
caxis([3,7]) % change caxis same as mar27_2017_omni_L_fesa_pile
Any help will be appreciated.

Respuesta aceptada

Voss
Voss el 25 de Oct. de 2024
load FPDO.mat
load E_log.mat
load T_.mat
T_ = T_lepi;
The problem is that T_ and E_log are not monotonic:
figure
subplot(2,1,1)
plot(T_,'.-')
ylabel('T\_')
subplot(2,1,2)
plot(E_log,'.-')
ylabel('E\_log')
So pcolor has to jump around and connect points across what would be the NaN gaps.
Sort the vectors and reorder the rows and columns of the matrix FPDO accordingly, pcolor with those reordered values, and you get the proper gaps where the NaNs are:
[T_sorted,Tidx] = sort(T_);
[E_log_sorted,Eidx] = sort(E_log);
FPDO_plot = FPDO(Tidx,Eidx);
figure
pcolor(T_sorted,E_log_sorted,FPDO_plot.');
axis tight
colormap(jet); shading interp;
clim([3,7])
Or reorder in the T dimension only:
[T_sorted,Tidx] = sort(T_);
FPDO_plot = FPDO(Tidx,:);
figure
pcolor(T_sorted,E_log,FPDO_plot.');
axis tight
colormap(jet); shading interp;
clim([3,7])
  2 comentarios
megha
megha el 25 de Oct. de 2024
@Voss amazing job! I would have never been able to figure this out! I appreciate your time and efforts. Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by