![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/494904/image.png)
How to write name inside polygon?
2 次查看(过去 30 天)
显示 更早的评论
After create a polygon how to write name inside it so you can differeniate between it and the other polygons?
0 个评论
采纳的回答
Star Strider
2021-1-20
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/494904/image.png)
.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!