TikZ:如何编辑箭头尖属性(颜色/形状/大小)?

TikZ:如何编辑箭头尖属性(颜色/形状/大小)?

我创建了以下工作分解结构(WBS)图表:

在此处输入图片描述


最小工作示例(MWE):

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}

\tikzset{
  basic/.style  = {draw, text width=5cm, drop shadow, font=\sffamily, rectangle,level distance=3cm,},
  level 0/.style = {basic, rounded corners=0pt, thin,   align=center, fill=black!20, minimum height=2cm},
  level 1/.style = {basic, rounded corners=0pt, thin,   align=center, fill=black!30,    text width=8em, minimum height=2cm, sibling distance = 150mm},
  level 2/.style = {basic,                      thin,   align=center, fill=black!40,    text width=8em, minimum height=2cm, sibling distance = 120mm},
  level 3/.style = {basic,                      thin,   align=center, fill=black!50,    text width=6.5em, minimum height=2cm, sibling distance = 40mm},
  level 4/.style = {basic,                      thin,   align=center, fill=black!50,    text width=5em, minimum height=2cm, node distance=2.5cm},
  >=latex
}

\begin{document}
\begin{tikzpicture}[edge from parent fork down,->,draw,black]

% root of the the initial tree, level 1
\node[level 0] {abcd}
% The first level, as children of the initial tree
    child {node[level 1] (c1) {abcd}
        child {node[level 2] (c11) {abcd}
            child {node[level 3] (c111) {abcd}}
            child {node[level 3] (c112) {abcd}}
        }
    }
    child {node[level 1] (c2) {abcd}
        child {node[level 2] (c21) {abcd}
            child {node[level 3] (c211) {abcd}}
            child {node[level 3] (c212) {abcd}}
        }
        child {node[level 2] (c22) {abcd}
            child {node[level 3] (c221) {abcd}}
            child {node[level 3] (c222) {abcd}}
            child {node[level 3] (c223) {abcd}}
        }
    };

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 4}]
\node [below of = c111, xshift=15pt] (c1111) {abcd};
\node [below of = c1111] (c1112) {abcd};
\node [below of = c1112] (c1113) {abcd};

\node [below of = c112, xshift=15pt] (c1121) {abcd};
\node [below of = c1121] (c1122) {abcd};
\node [below of = c1122] (c1123) {abcd};
\end{scope}

% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3}
\draw[->] (c111.195) |- (c111\value.west);

\foreach \value in {1,2,3}
\draw[->] (c112.195) |- (c112\value.west);

\end{tikzpicture}
\end{document}

现在的问题是:

我如何编辑箭头尖的大小、形状和颜色?我更喜欢带有填充形状的漂亮箭头。这些箭头的样式\textrightarrow与此图形不太匹配…… :-)

答案1

这就是arrows.meta目的。我所做的就是加载arrows.meta而不是箭头并更改>=latex>={Latex[width=2mm,length=4mm,red]}

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,shapes,positioning,shadows,trees}

\tikzset{
  basic/.style  = {draw, text width=5cm, drop shadow, font=\sffamily, rectangle,level distance=3cm,},
  level 0/.style = {basic, rounded corners=0pt, thin,   align=center, fill=black!20, minimum height=2cm},
  level 1/.style = {basic, rounded corners=0pt, thin,   align=center, fill=black!30,    text width=8em, minimum height=2cm, sibling distance = 150mm},
  level 2/.style = {basic,                      thin,   align=center, fill=black!40,    text width=8em, minimum height=2cm, sibling distance = 120mm},
  level 3/.style = {basic,                      thin,   align=center, fill=black!50,    text width=6.5em, minimum height=2cm, sibling distance = 40mm},
  level 4/.style = {basic,                      thin,   align=center, fill=black!50,    text width=5em, minimum height=2cm, node distance=2.5cm},
  >={Latex[width=2mm,length=4mm,red]}
}

\begin{document}
\begin{tikzpicture}[edge from parent fork down,->,draw,black]

% root of the the initial tree, level 1
\node[level 0] {abcd}
% The first level, as children of the initial tree
    child {node[level 1] (c1) {abcd}
        child {node[level 2] (c11) {abcd}
            child {node[level 3] (c111) {abcd}}
            child {node[level 3] (c112) {abcd}}
        }
    }
    child {node[level 1] (c2) {abcd}
        child {node[level 2] (c21) {abcd}
            child {node[level 3] (c211) {abcd}}
            child {node[level 3] (c212) {abcd}}
        }
        child {node[level 2] (c22) {abcd}
            child {node[level 3] (c221) {abcd}}
            child {node[level 3] (c222) {abcd}}
            child {node[level 3] (c223) {abcd}}
        }
    };

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 4}]
\node [below of = c111, xshift=15pt] (c1111) {abcd};
\node [below of = c1111] (c1112) {abcd};
\node [below of = c1112] (c1113) {abcd};

\node [below of = c112, xshift=15pt] (c1121) {abcd};
\node [below of = c1121] (c1122) {abcd};
\node [below of = c1122] (c1123) {abcd};
\end{scope}

% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3}
\draw[->] (c111.195) |- (c111\value.west);

\foreach \value in {1,2,3}
\draw[->] (c112.195) |- (c112\value.west);

\end{tikzpicture}
\end{document}

在此处输入图片描述

我猜你会缩小箭头,这只是为了显示你可能想要调整的两个相关参数。

相关内容