Patch

4 Ansichten (letzte 30 Tage)
zhiping
zhiping am 8 Jun. 2011
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'); %%%

Antworten (1)

Sean de Wolski
Sean de Wolski am 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)
  1 Kommentar
zhiping
zhiping am 8 Jun. 2011
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by