How to display two sets of color data in the one picture using patch function?

1 vue (au cours des 30 derniers jours)
Dr_Wang DUT
Dr_Wang DUT le 19 Oct 2017
Commenté : Dr_Wang DUT le 22 Oct 2017
two variables X and Yv are sets of color data, which share the same grid information. Now I want to display two sets of color data in the one picture using patch function. Can anyone help?
I want to achieve the following requirements through figure(4) : * X(e)>0.5 & Yv(e)<0.5 plot in one color, for example "red" * X(e)<0.5 & Yv(e)>0.5 plot in another color, for example "bule"
  • X(e)<0.5 & Yv(e)>0.5 plot in "yellow"
if true
load('data.mat');
figure(1)
% colormap(gray);
patch('Faces',nodecon,'Vertices',nodexy,'FaceVertexCData',X,'FaceColor','flat','Edgecolor','none');
axis equal; axis off;pause(1e-6);
figure(2)
% colormap(gray);
patch('Faces',nodecon,'Vertices',nodexy,'FaceVertexCData',Yv,'FaceColor','flat','Edgecolor','none');
axis equal; axis off;pause(1e-6);
figure(4)
hold on; % axis equal; axis off
% colormap(gray);
% colormap(jet)
for e=1:nelt
aabb=nodexy(nodecon(e,:),:) ;
f = [1 2 3 4];
if X(e)>0.5 & Yv(e)<0.5
patch('Faces',f,'Vertices',aabb,'FaceColor','red')
elseif X(e)<0.5 & Yv(e)>0.5
patch('Faces',f,'Vertices',aabb,'FaceColor','green')
elseif X(e)<0.5 & Yv(e)<0.5
patch('Faces',f,'Vertices',aabb,'FaceColor','b')
end
end
axis equal; axis off;pause(1e-6);
end

Réponses (1)

Image Analyst
Image Analyst le 22 Oct 2017
Try creating an image instead of using patch().
  1 commentaire
Dr_Wang DUT
Dr_Wang DUT le 22 Oct 2017
Could you tell me how to create an image based on the present data? Thank you.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by