Patch
5 views (last 30 days)
Show older comments
hi, I use the command 'patch' to create one or more strip. And I realise this function, but for now I want to add the information associated in the center of each polygon, how can I do? I found nothing similar. Thanks in advance.
Here is the code %%%%%%
figure y=[0 0 1 1;1 1 2 2]'; x=[0 10 10 0;0 10 10 0]'; c=[20 30]'; set(gca,'CLim',[0 40]); p=patch(x,y,''); set(p,'FaceColor','flat','FaceVertexCData',c,'CDataMapping','scaled'); %%%
0 Comments
Answers (1)
Sean de Wolski
on 8 Jun 2011
So you want to be able to see a smaller polygon inside a bigger one?
Use the facealpha and edgealpha properties to make the larger patch object more translucent and the inside one less translucent.
%Rendering overlay example
I1 = false(100,100,100); %First image
I1(10:90,10:90,30:70) = true; %make rectangular part of I true
[xx yy zz] = meshgrid(1:100,1:100,1:100); %second image sphere with radius 10 centered at (50,50,50)
I2 = sqrt((xx-50).^2+(yy-50).^2+(zz-50).^2)<10;
fv1 = isosurface(I1,0); %Make the triangles
fv2 = isosurface(I2,0);
%Blue ball inside light green box
figure; hold on
patch(fv1,'facecolor',[0 1 0],'facealpha',0.3,'edgecolor','none');%[.5 .5 0],'edgealpha',0.3);
patch(fv2,'facecolor',[0 0 1],'facealpha',0.7,'edgecolor','none');
view(19,28)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!