How to write name inside polygon?

조회 수: 6 (최근 30일)
ZeKkEn NoName
ZeKkEn NoName 2021년 1월 20일
댓글: Star Strider 2021년 1월 21일
After create a polygon how to write name inside it so you can differeniate between it and the other polygons?

채택된 답변

Star Strider
Star Strider 2021년 1월 20일
Use the text function.
Try this:
pgon = polyshape([1 3 5 7],[2 6 4 1]);
[xc,yc] = centroid(pgon);
figure
plot(pgon)
axis('equal')
text(xc,yc, sprintf('Polygon with centroid (%.2f, %.2f)', xc, yc), 'HorizontalAlignment','center', 'VerticalAlignment','middle')
producing:
.
  댓글 수: 2
ZeKkEn NoName
ZeKkEn NoName 2021년 1월 21일
Thanks
Star Strider
Star Strider 2021년 1월 21일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Polygons에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by