You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Tikz中给节点F添加带dr标注的前置箭头?

TikZ 节点输入箭头添加方案

问题修正与箭头添加说明

  1. 原代码存在一处错误:节点D的定位参数right of =S中的S未定义,需改为right of=F。
  2. 给节点F添加上方标注为dr的输入箭头,可通过定位节点左侧位置绘制箭头,并在箭头上方添加标注实现。

完整修正代码

\tikzstyle{Box} = [rectangle, rounded corners, 
minimum width=1.25cm, 
minimum height=1.25cm,
text centered, 
draw=black, fill=yellow!30]

\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{center}
    \begin{figure}
        \centering
    \begin{tikzpicture}[node distance=2cm]
        \node (F) [Box,  label=above:{\textcolor{red}{$I_1$}}] {$F$};
        \ 
        \node (D) [Box, right of =F, label=above:{\textcolor{red}{$I_2$}}] {$D$};
        \ 
        \node (W) [Box, right of =D, label=above:{\textcolor{red}{$I_3$}}] {$W$};
        \ 
        \node (R) [Box, right of =W, label=above:{\textcolor{red}{$I_4$}}] {$R$};

% 添加指向F的输入箭头,标注为dr
\draw [arrow] ([xshift=-1cm]F.west) -- node[above] {$dr$} (F.west);

\draw [arrow] (F) -- node[above]{\textcolor{red}{$\varphi_1$}}(D);
\draw [arrow] (D) -- node[above]{\textcolor{red}{$\varphi_2$}}(W);
\draw [arrow] (W) -- node[above]{\textcolor{red}{$\varphi_3$}}(R);
        
    \end{tikzpicture}
    \end{figure}
\end{center}

关键代码解释

  • [xshift=-1cm]F.west:定位到节点F左侧边缘向左偏移1cm的位置,作为箭头起点
  • node[above] {$dr$}:在箭头上方添加标注文本dr,如果需要和其他标注同色,可改为node[above]{\textcolor{red}{$dr$}}

内容的提问来源于stack exchange,提问作者Unique

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 16:50:10