tikz latex 中的颜色边和顶点

tikz latex 中的颜色边和顶点

您好,我有以下代码:

\usepackage{tkz-graph}
\usetikzlibrary{arrows}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,thick]
\SetGraphUnit{3} 
\tikzset{VertexStyle/.style = {draw,circle,thick,
                               minimum size=1cm,
                               font=\Large\bfseries},thick} 
\Vertex{1} \SOWE(1){2} \SOEA(1){3} \NOEA(3){L} 
\Edges(3,2,1) \Edge(3)(1) \Edge(L)(1)  \Edge(L)(3)  

\Loop[dist=2cm,dir=NO,label=$\phi_{1,1}$,labelstyle=above](1)  
\Loop[dist=2cm,dir=SOEA,label=$\phi_{3,3}$,labelstyle=below right](3)  

\path[every node/.style={swap,auto}]    (2) to node {$\phi_{2,1}$} (1)
                                            to node {$\phi_{3,1}$} (3)
                                            to node {$\phi_{2,3}$} (2)
                                        (L) to node {$\phi_{1}^L$} (1)
                                        (L) to node {$\phi_{}^L$} (3);
\draw[->] (1) to [bend right] node [above left] {$\phi_{1,2}$} (2);
\draw[->] (L) to [bend left=110] node [above left] {$\phi_{2}^L$} (2);

% it's possible with \Edge but Tikz's syntax is allowed too.
\end{tikzpicture}

我想把从顶点 (L) 到顶点 (1)、(2)、(3) 的所有边都涂成紫色,并将这些边上方的标签加粗,也涂成紫色。我真的不知道该怎么解决...非常感谢!!!

答案1

purple只需添加选项,即可轻松将边着色为紫色。节点也是如此。如果节点是着色边的一部分,它们将接管此颜色。但是,您不能写入仅对和\path (A) to (B) to[purple] (C);之间的部分进行着色。但您可以使用而不是,我在下面的示例中应用了它。(B)(C)edgeto

为了使数学符号变为粗体,您需要加载amsmath包并包装宏\mathbf{},或者由于此功能并非对每个符号都可用,\pmb{}因此需要包装每个应该变为粗体的符号。

最后,我尝试美化大弯曲箭头。

\documentclass[tikz, border=2pt]{standalone}

\usepackage{tkz-graph}
\usepackage{amsmath}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,thick]
\SetGraphUnit{3} 
\tikzset{VertexStyle/.style = {draw,circle,thick,
                               minimum size=1cm,
                               font=\Large\bfseries},thick} 
\Vertex{1} \SOWE(1){2} \SOEA(1){3} \NOEA(3){L} 
\Edges(3,2,1) \Edge(3)(1) \Edge(L)(1) \Edge(L)(3)  

\Loop[dist=2cm,dir=NO,label=$\phi_{1,1}$,labelstyle=above](1)  
\Loop[dist=2cm,dir=SOEA,label=$\phi_{3,3}$,labelstyle=below right](3)  

\path[every node/.style={swap,auto}]    (2) to node {$\phi_{2,1}$} (1)
                                            to node {$\phi_{3,1}$} (3)
                                            to node {$\phi_{2,3}$} (2)
                                        (L) edge[purple] node {$\pmb{\phi}_{\mathbf{1}}^{\pmb{L}}$} (1)
                                        (L) edge[purple] node {$\pmb{\phi}_{}^{\pmb{L}}$} (3);
\draw[->] (1) edge [bend right] node [above left] {$\phi_{1,2}$} (2);
\draw[->, purple] (L) edge [in=300, out=290, looseness=1.35] node [above left] {$\pmb{\phi}_{\mathbf{2}}^{\pmb{L}}$} (2);

\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容