如何使 tikz 图中的边缘变灰?

如何使 tikz 图中的边缘变灰?

我正在尝试将图表的边缘变灰,以突出感兴趣的区域。例如,我想让以下 MWE 中除标记为“感兴趣”的边缘之外的每个边缘都变灰。

\usefonttheme{serif}
\usepackage{tikz}
\usetikzlibrary{arrows}
\definecolor{burntorange}{cmyk}{0,0.52,1,0}

\begin{document}

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
 thick,main node/.style={circle,fill=blue!20,draw,font=\sffamily\Large\bfseries}]

  \node[main node, scale=1.4] (interest) {$i$};
  \node[main node, fill=blue!10] (j) [below left of=interest] {$j$};
  \node[main node, fill=blue!10] (k) [below right of=j] {$k$};
  \node[main node, fill=burntorange, below right of=interest, distance = 6cm ] (input) 
    [below right of=interest] {input $u$};

\path[every node/.style={font=\sffamily\small}]
(interest)
        edge [bend right] node[left] {$\mathbf{M}_{ji}$} (j)
        edge [loop above] node {$\mathbf{M}_{ii}$} (interest)
        edge [bend left] node {$\mathbf{M}_{ki}$} (k)
(j)     edge node [right] {$\mathbf{M}_{ij}$} (interest)
        edge [loop left] node {$\mathbf{M}_{jj}$} (j)
        edge [bend right] node[left] {$\mathbf{M}_{jk}$} (k)
(k)     edge node [right] {$\mathbf{M}_{kj}$} (j)
        edge node [bend right] {$\mathbf{M}_{ik}$} (interest)
        edge [loop below] node {$\mathbf{M}_{kk}$} (k)
(input) edge [bend right] node {$\mathbf{W}_i$} (interest)
        edge [bend left] node {$\mathbf{W}_k$} (k);
\end{tikzpicture}
\end{document}

答案1

我不确定这是否是你想要的:

\documentclass{beamer}
\usepackage{xcolor}
\usefonttheme{serif}
\usepackage{tikz}
\usetikzlibrary{arrows}
\definecolor{burntorange}{cmyk}{0,0.52,1,0}

\begin{document}

\begin{frame}
\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
 thick,main node/.style={circle,fill=blue!20,draw,font=\sffamily\Large\bfseries}]

  \node[main node, scale=1.4] (interest) {$i$};
  \node[main node, fill=blue!10] (j) [below left of=interest] {$j$};
  \node[main node, fill=blue!10] (k) [below right of=j] {$k$};
  \node[main node, fill=burntorange, below right of=interest, distance = 6cm ] (input) 
    [below right of=interest] {input $u$};

\begin{scope}[every node/.style={font=\sffamily\small}]
\path
(interest)
        edge [bend right] node[left] {$\mathbf{M}_{ji}$} (j)
        edge [loop above] node {$\mathbf{M}_{ii}$} (interest)
        edge [bend left] node {$\mathbf{M}_{ki}$} (k);
\path[every edge/.style={gray,draw=gray}]
(j)     edge node [right] {$\mathbf{M}_{ij}$} (interest)
        edge [loop left] node {$\mathbf{M}_{jj}$} (j)
        edge [bend right] node[left] {$\mathbf{M}_{jk}$} (k)
(k)     edge node [right] {$\mathbf{M}_{kj}$} (j)
        edge node [bend right] {$\mathbf{M}_{ik}$} (interest)
        edge [loop below] node {$\mathbf{M}_{kk}$} (k)
(input) edge [bend right] node {$\mathbf{W}_i$} (interest)
        edge [bend left] node {$\mathbf{W}_k$} (k);
\end{scope}
\end{tikzpicture}
\end{frame}

\end{document}

在此处输入图片描述

相关内容