图表的 L 形箭头(tikz/latex)

图表的 L 形箭头(tikz/latex)

有人能告诉我如何绘制带有文字的 L 形箭头(如附图所示)吗?我使用节点绘制普通箭头,但我不知道如何将它们变成 L 形。

在此处输入图片描述

我迄今为止的代码:

\documentclass[aspectratio=169]{beamer} 

\mode<presentation>
{
  \usetheme{default}
  \usecolortheme{default}
  \usefonttheme{default}
  \setbeamertemplate{navigation symbols}{}
} 

\usepackage[english]{babel}

\usepackage[utf8x]{inputenc}

\usepackage{bbold} %indicator function

\usepackage{centernot}


%%%% TIKZ STUFF

\usepackage{tikz}

\usetikzlibrary{calc}

\usetikzlibrary{fit,shapes.geometric}

\usetikzlibrary{arrows.meta}

\usetikzlibrary{matrix,shapes,arrows,fit,backgrounds}

\usepackage{booktabs,dcolumn}

\usepackage{tabularx}

\makeatother



\begin{document}

    \tikzset{   
        every picture/.style={remember picture,baseline},
        every node/.style={anchor=base,align=center,outer sep=-1pt},
        every path/.style={thick},
    }
    
    
    \usetikzlibrary {positioning}   


\begin{frame}[label=mechanisms_path]{}

\tikzstyle{block} = [circle, draw, fill=white,]

\tikzstyle{arrow} = [single arrow, rounded corners=2pt, fill=black!20, draw, minimum size=3cm, single arrow head extend=2mm, minimum height=3cm, minimum width=2.5cm]


\begin{tikzpicture}[overlay,remember picture]

\node<1->[arrow,](D) at (9.58,1.81) 

{ 

\tiny  TEXT 

};

\node<1->[block,  text centered, rounded corners,  minimum size=2cm] (E) at (12.8,2) 

{ 

\tiny TEXT 

};

\node<1->[single arrow, rounded corners=2pt, fill=black!20, draw, minimum size=2.38cm, single arrow head extend=2mm, shape border rotate=270, ](F) at (12.8,-0.02) 

{ 

\tiny TEXT 

};

\node<1->[block,  text centered, rounded corners,  minimum size=2cm] (G) at (12.8,-3.65) 

{ 

\tiny TEXT 

};

\node<1->[arrow, shape border rotate=180,](H) at (10,-3.65) 

{ 

\tiny TEXT 

};


\end{tikzpicture}

\end{frame}

\end{document}

我只是希望箭头是 L 形的(如附图所示)。

答案1

shapesTi 的库Z 提供的没有这样的形状。当然,可以创建它,但我认为最灵活的方法可能不是使用形状,而是使用路径并将节点附加到它们。

我创建了一种您可能想要使用的样式。它允许您更改箭头的粗细、尖端的大小(通过定义尖端延伸线宽的长度)以及填充颜色。Ti 提供的其他样式当然也可以使用 Z。可以使用路径上的节点放置文本。该选项rounded corners不适用于箭头尖端。

\documentclass[border=10pt]{standalone} 
\usepackage{tikz}
\usetikzlibrary{shapes.arrows, arrows.meta}

\tikzset{
    big arrow fill/.code={\definecolor{big arrow fill}{named}{#1}},
    big arrow fill={white},
    big arrow/.style 2 args={
        line width=#1, 
        -{Triangle[length={.5*(#1+#2)},width={#1+#2}]},
        postaction={
            -{Triangle[length={.5*(#1+#2)-sqrt(2)*1pt},width={#1+#2-sqrt(2)*2pt}]},
            draw=big arrow fill,
            line width={#1-1pt},
            shorten >={sqrt(2)*.5pt},
            shorten <=.5pt
        },
        every node/.style={
            text width=#1,
            align=center
        }
    }
}

\begin{document}

\begin{tikzpicture}

    \node[single arrow, draw] at (0,3) { I am a shape };

    \draw[big arrow={15pt}{5pt}, blue] (3,1) -- node[midway] {A} (3,0) -- node[midway] {B} (4,0) -- node[midway] {C} (4,-2);

    \draw[big arrow={15pt}{5pt}] (5,4) arc (180:270:3cm) node[midway] {A};

    \draw[big arrow={3cm}{15pt}, big arrow fill=yellow] (0,1) -- node[midway] {maybe this is a way}  (0,-4) -- node[midway] {to solve this problem ...} (5,-4);

\end{tikzpicture}

\end{document}

在此处输入图片描述

答案2

使用三角形的快速而肮脏的解决方案:

\documentclass[aspectratio=169]{beamer} 

\mode<presentation>
{
  \usetheme{default}
  \usecolortheme{default}
  \usefonttheme{default}
  \setbeamertemplate{navigation symbols}{}
} 

\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{matrix}
\usetikzlibrary {shapes.geometric}

\tikzset{
    block/.style={
        circle, draw, fill=white
        },
    myarrow/.style={
        single arrow, rounded corners=2pt, fill=black!20, draw, minimum size=3cm, single arrow head extend=2mm, minimum height=3cm, minimum width=2.5cm 
        },
    mytri/.style={
        isosceles triangle, anchor=apex,
        isosceles triangle apex angle=90,
        minimum width=50pt
        }
    }
\begin{document}
\begin{frame}\centering
\begin{tikzpicture}
\matrix[matrix of nodes,
nodes={circle, draw,
minimum size=10pt},
ampersand replacement=\&,
row sep=50pt,
column sep=40pt](mymatr){1\&\&[-20pt]2\&[40pt]\\
\&6\&\&3\\
5\&\&4\\};
\draw[->] (mymatr-1-1) -- node[above] {Some} (mymatr-1-3);
\draw[->] (mymatr-1-3) -- node[left] {Some} (mymatr-2-2);
\draw[->] (mymatr-1-3) -- node[right] {Some} (mymatr-3-3);
\draw[->] (mymatr-2-2) -- node[left] {Some} (mymatr-3-3);
\draw[->] (mymatr-3-3) -- node[below] {Some} (mymatr-3-1);
\node[right=0pt of mymatr-1-3,  
minimum height=30pt] (suprec) {};
\node[align=left, anchor=west, font=\footnotesize] at (suprec) {Something\\ something else};
\node[above=0pt of mymatr-2-4, mytri, rotate=-90] (suptri) {};
\coordinate (suptrir) at ([xshift=10pt]suptri.right corner);
\coordinate (suptril) at ([xshift=-10pt]suptri.left corner);
\draw (suptri.apex) -- (suptri.left corner)
(suptri.apex) -- (suptri.right corner)
(suptri.right corner) -- (suptrir)
(suptri.left corner) -- (suptril)
(suprec.south west) -| (suptrir)
(suprec.north west) -| (suptril)
(suprec.south west) -- (suprec.north west);
\node[below=0pt of mymatr-2-4, align=left, 
minimum width=30pt] (infrec) {};
\node[right=0pt of mymatr-3-3, mytri,  rotate=180] (inftri) {};
\coordinate (inftrir) at ([yshift=-10pt]inftri.right corner);
\coordinate (inftril) at ([yshift=10pt]inftri.left corner);
\draw
(infrec.north west) -- (infrec.north east) 
(infrec.north west) |- (inftrir)
(infrec.north east) |- (inftril)
(inftri.apex) -- (inftri.left corner)
(inftri.apex) -- (inftri.right corner)
(inftri.right corner) -- (inftrir)
(inftri.left corner) -- (inftril);
\node[align=left, anchor=north west, text width=26pt, font=\footnotesize] at (infrec.north west) {Some\-thing written here};
\node[align=left, anchor=west, text width=50pt, font=\footnotesize] at (inftri.lower side) {Some\-thing else written here};
\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

编辑
所有箭头都较粗:

\documentclass[aspectratio=169]{beamer} 

\mode<presentation>
{
  \usetheme{default}
  \usecolortheme{default}
  \usefonttheme{default}
  \setbeamertemplate{navigation symbols}{}
} 

\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{matrix}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{calc}

\tikzset{
    block/.style={
        circle, draw, fill=white
        },
    myarrow/.style={
        single arrow, rounded corners=2pt, fill=black!20, draw, 
        single arrow head extend=2mm, minimum width=30pt,
        font=\footnotesize
        },    
    myar/.style={
        rounded corners=2pt, fill=black!20, 
        },
    mytri/.style={
        isosceles triangle, anchor=apex,
        isosceles triangle apex angle=90,
        minimum width=50pt
        },
    }
    
\begin{document}
\begin{frame}\centering
\begin{tikzpicture}
\matrix[matrix of nodes,
    nodes={circle, draw,
    minimum size=10pt},
    ampersand replacement=\&,
    row sep=50pt,
    column sep=60pt]
    (mymatr)
    {1\&\&[-20pt]2\&[40pt]\\
    \&6\&\&3\\
    5\&\&4\\};
\node[myarrow, anchor=west, minimum height=112pt] at ([xshift=4pt]mymatr-1-1.east) {Some 1};
\coordinate (n2vsn6) at ($(mymatr-1-3)!.85!(mymatr-2-2)$);
\node[myarrow, anchor=tip, minimum height=64pt, rotate around={230:(n2vsn6)}] at (n2vsn6) {\rotatebox{180}{Some 2}};
\coordinate (n6vsn4) at ($(mymatr-2-2)!.85!(mymatr-3-3)$);
\node[myarrow, anchor=tip, minimum height=64pt, rotate around={-50:(n6vsn4)}] at (n6vsn4) {Some 3};
\node[myarrow, anchor=tip, minimum height=112pt, rotate=-90] at ([yshift=4pt]mymatr-3-3.north) {Some 4};
\node[myarrow, anchor=tip, minimum height=112pt, rotate=180] at ([xshift=4pt]mymatr-3-1.east) {\rotatebox{180}{Some 5}};

\node[right=4pt of mymatr-1-3,  
minimum height=30pt] (suprec) {};
\node[above=4pt of mymatr-2-4, mytri, rotate=-90] (suptri) {};
\coordinate (suptrir) at ([xshift=10pt]suptri.right corner);
\coordinate (suptril) at ([xshift=-10pt]suptri.left corner);
\draw[myar]
     (suprec.north west) 
    -| (suptril) -- (suptri.left corner) 
    -- (suptri.apex) -- (suptri.right corner)
    -- (suptrir) |- (suprec.south west) -- cycle;
\node[align=left, anchor=west, font=\footnotesize] at (suprec) {Something\\ something else};
\node[below=4pt of mymatr-2-4, align=left, 
minimum width=30pt] (infrec) {};
\node[right=4pt of mymatr-3-3, mytri,  rotate=180] (inftri) {};
\coordinate (inftrir) at ([yshift=-10pt]inftri.right corner);
\coordinate (inftril) at ([yshift=10pt]inftri.left corner);
\draw[myar]
     (infrec.north east) 
    |- (inftril) -- (inftri.left corner) 
    -- (inftri.apex) -- (inftri.right corner)
    -- (inftrir) -| (infrec.north west) -- cycle;
\node[align=left, anchor=north west, text width=26pt, font=\footnotesize] at (infrec.north west) {Some\-thing written here};
\node[align=left, anchor=west, text width=50pt, font=\footnotesize] at (inftri.lower side) {Some\-thing else written here};
\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

相关内容