我怎样才能防止 tikz 箭头过度绘制?

我怎样才能防止 tikz 箭头过度绘制?

我正在创建一个图表,其中有多个箭头从同一个节点出来。问题是,在许多 PDF 查看器中,箭头在某些缩放级别下会变得稍微模糊,因此当它们相互叠加时,线条会显得更粗,如下所示:

粗线

\documentclass[10pt]{amsart}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}

\begin{tikzpicture}[
  font=\sffamily,
  every matrix/.style={ampersand replacement=\&,column sep=1cm,row sep=0.5cm},
  data/.style={draw,thick,fill=yellow!20,inner sep=.3cm},
  to/.style={->,>=stealth',shorten >=1pt,semithick,font=\sffamily\footnotesize},
  every node/.style={align=center}]

  \matrix{
    \node[data] (a) {a};\\
    \node[data] (b) {b};\\
    \node[data] (c) {c};\\
  };


  \draw[to] (a.east) -- ++(0.5,0) |- (b.east);
  \draw[to] (a.east) -- ++(0.5,0) |- (c.east);
\end{tikzpicture}

\end{document}

答案1

定义一个中间坐标aa,然后使用正交坐标 -b.east -|aa

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{positioning}
\begin{document}
  \begin{tikzpicture}
    \node[draw] (a) at (0,0) {Some};
    \node[draw,below=1cm of a] (b)  {Some one};
    \node[draw,below=1cm of b] (c)  {Some two};
    \node[draw,below=1cm of c] (d)  {Some three};
    \draw[->] (a.east) -- ++(1,0pt)coordinate (aa) |- (d.east);
    \draw[<-] (b.east) -- (b.east -|aa);
    \draw[<-] (c.east) --  (c.east -| aa);
  \end{tikzpicture}
\end{document}

在此处输入图片描述

您的代码执行以下操作:

\draw[to] (a.east) -- ++(0.5,0) coordinate (aa) |- (c.east);
\draw[to] (b.east -| aa) --  (b.east);

在此处输入图片描述

相关内容