How to display two sets of color data in the one picture using patch function?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens

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
0 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Polygons dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!