如何向 Tikz 图片添加阴影、粗箭头?

如何向 Tikz 图片添加阴影、粗箭头?

我创建了一个有向图,想添加一个粗阴影箭头来表示随时间的变化。问题是:它应该从一个边缘到另一个边缘(从初始状态到结果状态),而不是像其他箭头一样从一个节点到另一个节点。有什么办法吗?我找到了一个足够接近“粗阴影”的箭头代码,但我似乎无法将其放在正确的位置。

        \documentclass[12pt,a4paper]{article}

        \usepackage{tikz}
        \usetikzlibrary{arrows,automata,positioning}

        \newcommand{\feat}[1]{\textsc{#1}}
        \newcommand{\type}[1]{\textit{#1}}
        \newcommand{\fsbase}[1]{{\scriptsize #1}}

        \begin{document}

        \begin{tikzpicture}
    [
     semithick, x=2.4cm,y=0.9cm, >=latex, baseline=7ex,
    % anchor=base,
     inner sep=.2ex, outer sep=.6ex, minimum size=3.0ex
    ]
    {\node (pc) at ( 1.5, 2.0) [circle,double,draw,minimum size=4ex,thick,label=90:$\type{bumfuzzlement}$] {\fsbase{}};}
    {\node (in) at ( 0.0, 0.0) [circle,draw,label={[label distance=-1ex]175:$\type{interaction}$}] {\fsbase{}};}
    {\node (en1) at ( -0.5,-3.0) [circle,draw,label=left:$\type{entity}$] {\fsbase{}};}
    {\node (en2) at ( 0.5,-3.0) [circle,draw,label=right:$\type{entity}$] {\fsbase{}};}
    {\node (an) at ( 0.5,-5.0) [circle,draw,label=below:$\type{animate}$] {\fsbase{}};}
    {\node (ch) at ( 3.0,-0.0) [circle,draw,label={[label distance=-1ex]20:$\type{change of psych state}$}] {\fsbase{}};}
    {\node (ps1) at ( 2.5,-3.0) [circle,draw,label=left:$\type{psych state}$] {};}
    {\node (ps2) at ( 3.5,-3.0) [circle,draw,label=right:$\type{psych state}$] {};}


    {\path[->](pc) edge[bend right=15] node[above left]{\feat{cause}} (in);}
    {\path[->](pc) edge[bend left=15] node[above right]{\feat{effect}} (ch);}
    {\path[->](in) edge[bend right=15] node[left]{\feat{stimulus}} (en1);}
    {\path[->](in) edge[bend left=15] node[right]{\feat{experiencer}} (en2);}
     {\path[->](en2) edge[bend left=0] node[right]{\feat{animacy}} (an);}
    {\path[->](ch) edge[bend right=15]
     node[left]{\feat{initial state}} (ps1);}
    {\path[->](ch) edge[bend left=15] node[right]{\feat{result state}} (ps2);}
     {\path[->](en2) edge[bend left=13] node[above]{\feat{experience}} (ch);}
    {\path[->](pc) edge[bend right=75,dashed] node[above]{\feat{}} (en1);}
    {\path[->](pc) edge[bend left=75,dashed] node[above]{\feat{}} (ps2);}
    {\path[-](ps1) edge[bend left=0] node[below]{\feat{$\neq$}} (ps2);}

    \end{tikzpicture}

\tikz\draw[line width=1mm,-implies,double, double distance=1mm] (0,0) -- (1,0);


        \end{document}

答案1

可以将节点添加到边缘时为其命名,以便以后使用。在您的示例中,您只需为以下节点添加名称

{\path[->](ch) edge[bend right=15] node[left](initial state){\feat{initial state}} (ps1);}
{\path[->](ch) edge[bend left=15] node[right](result state){\feat{result state}} (ps2);}

(请注意,我在选项字段[]和标签字段之间为每个节点添加了一个名称{})然后您可以使用这些名称来绘制箭头:

\draw[line width=1mm,-implies,double, double distance=1mm] (initial state) -- (result state);

完整的代码如下:

\documentclass[12pt,a4paper]{article}
\usepackage{tikz}
\usetikzlibrary{arrows,automata,positioning}

\newcommand{\feat}[1]{\textsc{#1}}
\newcommand{\type}[1]{\textit{#1}}
\newcommand{\fsbase}[1]{{\scriptsize #1}}

\begin{document}

\begin{tikzpicture}
[
 semithick, x=2.4cm,y=0.9cm, >=latex, baseline=7ex,
% anchor=base,
 inner sep=.2ex, outer sep=.6ex, minimum size=3.0ex
]
    {\node (pc) at ( 1.5, 2.0) [circle,double,draw,minimum size=4ex,thick,label=90:$\type{bumfuzzlement}$] {\fsbase{}};}
    {\node (in) at ( 0.0, 0.0) [circle,draw,label={[label distance=-1ex]175:$\type{interaction}$}] {\fsbase{}};}
    {\node (en1) at ( -0.5,-3.0) [circle,draw,label=left:$\type{entity}$] {\fsbase{}};}
    {\node (en2) at ( 0.5,-3.0) [circle,draw,label=right:$\type{entity}$] {\fsbase{}};}
    {\node (an) at ( 0.5,-5.0) [circle,draw,label=below:$\type{animate}$] {\fsbase{}};}
    {\node (ch) at ( 3.0,-0.0) [circle,draw,label={[label distance=-1ex]20:$\type{change of psych state}$}] {\fsbase{}};}
    {\node (ps1) at ( 2.5,-3.0) [circle,draw,label=left:$\type{psych state}$] {};}
    {\node (ps2) at ( 3.5,-3.0) [circle,draw,label=right:$\type{psych state}$] {};}


    {\path[->](pc) edge[bend right=15] node[above left]{\feat{cause}} (in);}
    {\path[->](pc) edge[bend left=15] node[above right]{\feat{effect}} (ch);}
    {\path[->](in) edge[bend right=15] node[left]{\feat{stimulus}} (en1);}
    {\path[->](in) edge[bend left=15] node[right]{\feat{experiencer}} (en2);}
    {\path[->](en2) edge[bend left=0] node[right]{\feat{animacy}} (an);}
    {\path[->](ch) edge[bend right=15] node[left](initial state){\feat{initial state}} (ps1);}
    {\path[->](ch) edge[bend left=15] node[right](result state){\feat{result state}} (ps2);}
    {\path[->](en2) edge[bend left=13] node[above]{\feat{experience}} (ch);}
    {\path[->](pc) edge[bend right=75,dashed] node[above]{\feat{}} (en1);}
    {\path[->](pc) edge[bend left=75,dashed] node[above]{\feat{}} (ps2);}
    {\path[-](ps1) edge[bend left=0] node[below]{\feat{$\neq$}} (ps2);}

    \draw[line width=1mm,-implies,double, double distance=1mm] (initial state) -- (result state);
\end{tikzpicture}
\end{document}

相关内容