Patch

5 次查看(过去 30 天)
zhiping
zhiping 2011-6-8
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'); %%%

回答(1 个)

Sean de Wolski
Sean de Wolski 2011-6-8
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)
  1 个评论
zhiping
zhiping 2011-6-8
no, excuse me, I gave few details, there are a part of 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');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I want to write some information associated in the centre of each strip, for example, the width of each strip( different color)... etc

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by