![tikz 图的各个顶点/节点的不同颜色和自定义](https://linux22.com/image/393226/tikz%20%E5%9B%BE%E7%9A%84%E5%90%84%E4%B8%AA%E9%A1%B6%E7%82%B9%2F%E8%8A%82%E7%82%B9%E7%9A%84%E4%B8%8D%E5%90%8C%E9%A2%9C%E8%89%B2%E5%92%8C%E8%87%AA%E5%AE%9A%E4%B9%89.png)
所以我画的图是这样的
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzset{Bullet/.style={fill=black,draw,color=black,circle,minimum size=3pt,scale=0.75}}
\node[Bullet,label=left :{$u_1$}] (u1) at (0,2){};
\node[Bullet,label=above:{$u_2$}] (u2) at (1,3){};
\node[Bullet,label=right:{$u_3$}] (u3) at (2,2){};
\node[Bullet,label=right:{$u_4$}] (u4) at (2,0){};
\node[Bullet,label=left :{$u_5$}] (u5) at (0,0){};
\draw[thick] (u1)--(u4)--(u5)--(u3)--(u2)--(u1);
\end{tikzpicture}
\end{document}
我想为每个节点/顶点设置单独的颜色。我可以这样做,但似乎有点笨拙。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\tikzset{Bullet/.style={fill=black,draw,color=red,circle,minimum size=3pt,scale=0.75}}
\node[Bullet,label=left :{$u_1$}] (u1) at (0,2){};
\tikzset{Bullet/.style={fill=black,draw,color=orange,circle,minimum size=3pt,scale=0.75}}
\node[Bullet,label=above:{$u_2$}] (u2) at (1,3){};
\tikzset{Bullet/.style={fill=black,draw,color=yellow,circle,minimum size=3pt,scale=0.75}}
\node[Bullet,label=right:{$u_3$}] (u3) at (2,2){};
\tikzset{Bullet/.style={fill=black,draw,color=green,circle,minimum size=3pt,scale=0.75}}
\node[Bullet,label=right:{$u_4$}] (u4) at (2,0){};
\tikzset{Bullet/.style={fill=black,draw,color=blue,circle,minimum size=3pt,scale=0.75}}
\node[Bullet,label=left :{$u_5$}] (u5) at (0,0){};
\draw[thick] (u1)--(u4)--(u5)--(u3)--(u2)--(u1);
\end{tikzpicture}
\end{document}
我真正想要的是让它看起来像这样,以突出同构:
答案1
我不知道你重新提出这个问题的目的是什么。链接的问题(或 Kpym 的评论)确实确切地你想要得到什么。
\documentclass{standalone}
\usepackage{tikz}
\tikzset{Bullet/.style={fill=black,draw,color=#1,circle,minimum size=3pt,scale=0.75}}
\begin{document}
\begin{tikzpicture}
\node[Bullet=red,label=left :{$u_1$}] (u1) at (0,2){};
\node[Bullet=orange,label=above:{$u_2$}] (u2) at (1,3){};
\node[Bullet=yellow,label=right:{$u_3$}] (u3) at (2,2){};
\node[Bullet=green,label=right:{$u_4$}] (u4) at (2,0){};
\node[Bullet=blue,label=left :{$u_5$}] (u5) at (0,0){};
\draw[thick] (u1)--(u4)--(u5)--(u3)--(u2)--(u1);
\end{tikzpicture}
\end{document}