在 Tikz 图中填充自定义形状

在 Tikz 图中填充自定义形状

我正在尝试使用 tikz 在 beamer 演示文稿中模拟 power point 智能图表,但我就是不知道如何填充下图中的箭头形状

在此处输入图片描述

我使用的代码是

\begin{tikzpicture}
  \tikzset{
    item/.style={draw, rounded corners=3pt, text width=9cm, minimum height=2cm, font=\Huge},
    flecha/.pic={
      \coordinate (p1);
      \coordinate (p2) at ([xshift=4mm] p1);
      \coordinate (p3) at ([yshift=-5mm] p2);
      \coordinate (p4) at ([xshift=1mm] p3);
      \coordinate (p5) at ([yshift=-2mm, xshift=-3mm] p4);
      \coordinate (p6) at ([yshift=2mm, xshift=-3mm] p5);
      \coordinate (p7) at ([xshift=1mm] p6);
      \filldraw[fill=green] (p1) -- (p2) --(p3) -- (p4) -- (p5) -- (p6) -- (p7) -- (p1);},
  }

  \node[item] (i1) {\textbf{Análisis}};
  \node[item, anchor=north] at ([yshift=-5mm, xshift=7mm] i1.south) (i2) {\textbf{Diseño}};
  \node[item, anchor=north] at ([yshift=-5mm, xshift=7mm] i2.south) (i3) {\textbf{Construcción}};
  \pic at ([yshift=1mm, xshift=-7mm] i2.south east) (f2) {flecha};      
  \pic at ([yshift=1mm, xshift=-7mm] i1.south east) (f1) {flecha};
\end{tikzpicture}

我如何定义箭头的填充颜色?

答案1

single arrow从库中使用起来会容易得多shapes。您可以根据自己的喜好为其设置样式,例如bigarrow/.style={single arrow, draw, single arrow head extend=1mm, rotate=-90,fill=green}

\documentclass[border=2pt,tikz]{standalone}
\usetikzlibrary{shapes}
\begin{document}

\begin{tikzpicture}[
  item/.style={draw, rounded corners=3pt, text width=9cm, minimum height=2cm, font=\Huge},
  bigarrow/.style={single arrow, draw, single arrow head extend=1mm, rotate=-90,fill=green},    
  ]

  \node[item] (i1) {\textbf{Análisis}};
  \node[item, anchor=north] at ([yshift=-5mm, xshift=7mm] i1.south) (i2) {\textbf{Diseño}};
  \node[item, anchor=north] at ([yshift=-5mm, xshift=7mm] i2.south) (i3) {\textbf{Construcción}};

  \node [bigarrow] at ([yshift=-2mm, xshift=-5mm] i1.south east) (f1){\phantom{do}};
  \node [bigarrow] at ([yshift=-2mm, xshift=-5mm] i2.south east) (f2){\phantom{do}};
\end{tikzpicture}

\end{document}

在此处输入图片描述

相关内容