wolfram-mathematica - 在Mathematica中标注多边形的顶点

标签 wolfram-mathematica plot

给定平面T={a1,a2,...,an}中的一组点,然后Graphics[Polygon[T]]将绘制由这些点生成的多边形。如何为多边形的顶点添加标签?仅将索引作为标签会比没有更好。有任何想法吗?

最佳答案

pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}};
Graphics[
 {{LightGray, Polygon[pts]},
  {pts /. {x_, y_} :> Text[Style[{x, y}, Red], {x, y}]}}
 ]

也要加点
pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}};
Graphics[
 {{LightGray, Polygon[pts]},
  {pts /. {x_, y_} :> Text[Style[{x, y}, Red], {x, y}, {0, -1}]},
  {pts /. {x_, y_} :> {Blue, PointSize[0.02], Point[{x, y}]}}
  }
 ]

更新:

使用索引:
pts = {{1, 0}, {0, Sqrt[3]}, {-1, 0}};
Graphics[
 {{LightGray, Polygon[pts]},
  {pts /. {x_, y_} :> 
     Text[Style[Position[pts, {x, y}], Red], {x, y}, {0, -1}]}
  }
 ]

关于wolfram-mathematica - 在Mathematica中标注多边形的顶点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6922891/

相关文章:

matrix - 为什么回代 Solve[] 的结果没有给出预期的结果?

wolfram-mathematica - 如何在mma中获取内置函数的所有消息?即所有罪的信息

R:使用 colorRampPalette 的透明颜色

R Shiny : plot with dynamical size

list - Mathematica 中的规则行为和初始列表的长度

python - 比较 Mathematica 和 Python 中的卷积

wolfram-mathematica - 数学 : is it possible to put AxesLabel for 3D graphics at the end of the axes as in 2D?

python - 以 AM/PM 格式绘制 Pandas Datetime 时间序列

r - R 中 CSV 文件数据的频率分布图

python - 将数据集与绘图进行比较 - 将虚线与实线混合