pcolor issue with irregular grid
Afficher commentaires plus anciens
I have been spending way too much time and would appreciate your insight and comments.
I am using “pcolor” to plot my data on an irregular grid (regularizing it is not an option).
-when I plot the even rows of my X, Y, and data the figure is what I expect (figure 1).
-when I plot the odd rows of my X, Y, and data the figure is what I expect (figure 2).
-when I plot the all rows of my X, Y, and data the figure is NOT what I expect (figure 3).
**figure 3 should be similar to figures 1&2 (basically those 2 superimposed).
the data, X, and Y are attched.
Thanks again.

clear all; close all; clc
load('C:\Desktop\Test\X.mat');
load('C:\Desktop\Test\Y.mat');
load('C:\Desktop\Test\data.mat');
% replaceing zeros with NAN
X(X == 0) = NaN;
Y(Y == 0) = NaN;
data(data == 0) = NaN;
% choosing even rows
X1 = X(2:2:end,:);
Y1 = Y(2:2:end,:);
data1 = data(2:2:end,:);
% choosing odd rows
X2 = X(1:2:end,:);
Y2 = Y(1:2:end,:);
data2 = data(1:2:end,:);
figure(1)
h1 = pcolor(X1,Y1,data1);
set(h1,'edgecolor','none');
figure(2);
h2 = pcolor(X2,Y2,data2);
set(h2,'edgecolor','none');
figure(3);
h3 = pcolor(X,Y,data);
set(h3,'edgecolor','none');
2 commentaires
Mathieu NOE
le 20 Déc 2020
hi
have to figure out why pcolor is doing that
with imagesc I don't have the problem
clear all; close all; clc
load('X.mat');
load('Y.mat');
load('data.mat');
% replaceing zeros with NAN
X(X == 0) = NaN;
Y(Y == 0) = NaN;
data(data == 0) = NaN;
% choosing even rows
X1 = X(2:2:end,:);
Y1 = Y(2:2:end,:);
data1 = data(2:2:end,:);
% choosing odd rows
X2 = X(1:2:end,:);
Y2 = Y(1:2:end,:);
data2 = data(1:2:end,:);
figure(1)
h1 = imagesc(data1);
% set(h1,'edgecolor','none');
figure(2);
h2 = imagesc(data2);
% set(h2,'edgecolor','none');
figure(3);
h3 = imagesc(data);
% set(h3,'edgecolor','none');
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Annotations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!