如何向图表添加标签

如何向图表添加标签

我已经创建了一个图表,但我无法在代码下方的节点中添加标签

\begin{tikzpicture}
\SetGraphUnit{4}
\SetVertexArt
\renewcommand*{\VertexInnerSep}{8pt}
\renewcommand*{\VertexBallColor}{blue!50}
\Vertices{circle}{1,2,3,4,5,6,7,8}
\AddVertexColor{blue}{1,2,3,4,5,6,7,8}
\SetUpEdge[style={->,ultra thick},color=blue!50]
\Edge(1)(2)
\Edge(1)(3)
\Edge(1)(4)
\Edge(1)(5)
\Edge(1)(6)
\Edge(2)(3)
\Edge(2)(4)
\Edge(2)(5)
\Edge(2)(6)
\Edge(3)(4)
\Edge(3)(5)
\Edge(3)(6)
\Edge(4)(5)
\Edge(4)(6)
\Edge(5)(6)
\Edge(2)(6)
\Edge(2)(3)
\Edge(2)(1)
\Edge(2)(8)
\Edge(6)(3)
\Edge(6)(1)
\Edge(6)(8)
\Edge(3)(1)
\Edge(3)(8)
\Edge(1)(8)
\Edge(7)(8)
\Edge(5)(1)
\Edge(5)(6)
\Edge(5)(2)
\Edge(5)(7)
\Edge(1)(6)
\Edge(1)(2)
\Edge(1)(7)
\Edge(6)(2)
\Edge(6)(7)
\Edge(2)(7)
\end{tikzpicture}

你能帮助我吗?提前致谢

答案1

art用 定义的样式似乎\SetVertexArt隐藏了顶点的文本标签。如果您用 代替 \SetVertexArt\AddVertexColor{blue}{1,2,3,4,5,6,7,8}添加\GraphInit[vstyle=Shade],则会得到类似的结果,但标签可见。

(当切换到宏时,我可能弄乱了绘制的边缘\Edges。你已经绘制了两次边缘,所以我尝试删除它们。)

在此处输入图片描述

\documentclass[border=5mm]{standalone}
\usepackage{tkz-graph}
\begin{document}
\begin{tikzpicture}
\GraphInit[vstyle=Shade]
\SetGraphUnit{4}
\renewcommand*{\VertexInnerSep}{8pt}
\renewcommand*{\VertexBallColor}{blue!50}
\Vertices{circle}{1,2,3,4,5,6,7,8}
\SetUpEdge[style={->,ultra thick},color=blue!50]
\Edges(
   1,2,
   1,3,
   1,4,
   1,5,
   1,6,
   1,7,
   1,8,
   2,1,
   2,3,
   2,4,
   2,5,
   2,6,
   2,7,
   2,8,
   3,1,
   3,4,
   3,5,
   3,6,
   3,8,
   4,5,
   4,6,
   5,1,
   5,2,
   5,6,
   5,7,
   6,1,
   6,2,
   6,3,
   6,7,
   6,8,
   7,8)
\end{tikzpicture}
\end{document}

相关内容