Numbered Patches
조회 수: 5 (최근 30일)
이전 댓글 표시
Hello all,
The matlab documentation for patch shows an example where the patch faces and vertices are numbered.
Is it possible to automatically generate a numbered plot like this or is numbering only possible by annotating?
Thanks cjm2176
댓글 수: 0
답변 (1개)
Matt Fig
2011년 5월 26일
It could be automated, something like:
xdata = [2 2 0 2 5;
2 8 2 4 5;
8 8 2 4 8];
ydata = [4 4 4 2 0;
8 4 6 2 2;
4 0 4 0 0];
zdata = zeros(3,5);
patch(xdata,ydata,zdata,'w')
mnx = sum(xdata)./size(xdata,1); % Or MEAN...
mny = sum(ydata)./size(ydata,1);
for ii = 1:numel(mnx)
T(ii) = text(mnx(ii),mny(ii),num2str(ii));
end
set(T,'color','b','fonts',12,'fontweight','bold')
The code after the patch creation could be put into a function M-file which takes the patch object's handle as an arg. Then from there extracts the vertices and does it's job. Of course it should go without saying that this approach will not work for certain patch shapes...
댓글 수: 1
Walter Roberson
2011년 5월 26일
And to answer the original question more explicitly: there is no (documented) Mathworks supplied routine or plotting option that does this on your behalf.
참고 항목
카테고리
Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!