沿線繪製垂直線作為節點

沿線繪製垂直線作為節點

我創建了以下 Tikzpicutre:

在此輸入影像描述

\begin{tikzpicture}
    \node (Borrow) at (-3, 9) {$b < 0$};
    \node (Lend) at (3, 9) {$b > 0$};
    \node (Top) at (0, 11) {$i^{dw}$};
    \node (Bottom) at (0, 7) {$i^m$};
    \draw[|-|] (Top) -- (Bottom) node[pos =0.6, right] (Funds) {$i^{ff}, \Lambda$}
    node[pos =0.2, right] (AverageBorrowing) {$\chi^{-}$}
    node[pos =0.8, right] (AverageLending) {$\chi^{+}$};
    \draw[->] (Borrow) -- (Top) node[pos = 0.66, above] (DW)  {$1-\varphi^{-}$};
    \draw[->] (Borrow) -- (Funds) node[pos = 0.66, above] (BFunds)  {$\varphi^{-}$};
    \draw[->] (Lend) -- (Bottom) node[pos = 0.3, below] (Overnight)  {$1-\varphi^{+}$};
     \draw[->] (Lend) -- (Funds) node[pos = 0.3, above] (LFunds)  {$\varphi^{+}$};
\end{tikzpicture}

我沿著頂部(註釋為 i^dw)和底部(註釋為 i^m)之間的垂直線創建了三個節點。我想改變圖片的兩個元素:

  • 我不想將這些節點的文字對齊在右側,而是將其對齊在東北(右上角)。
  • 三個節點中的每個節點的頂級節點和底部節點之間都應該有一條水平線交叉。中間節點(資金)的箭頭應指向垂直線而不是文字。

有人可以建議一種實現這兩個更改的方法嗎?

答案1

我不確定我是否正確理解了您的所有描述。我認為您希望附加到垂直線的節點文字在右上角對齊。這可以使用anchor=south west.但是你想使用在線上的定位來附加箭頭和垂直線,所以我認為使用盡可能小的節點並使用labelti 在其外部設定文字會更容易。然後我以這樣的方式結束。

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
    \node (Borrow) at (-3, 9) {$b < 0$};
    \node (Lend) at (3, 9) {$b > 0$};
    \node (Top) at (0, 11) {$i^{dw}$};
    \node (Bottom) at (0, 7) {$i^m$};
    \draw[|-|] (Top) -- (Bottom) node[pos =0.6,label=45:{$i^{ff},\Lambda$},inner sep=0pt] (Funds) {}
    node[pos =0.2,inner sep=0pt,label=45:{$\chi^{-}$}] (AverageBorrowing) {}
    node[pos =0.8,inner sep=0pt,label=45:{$\chi^{+}$}] (AverageLending) {};
    \draw[->] (Borrow) -- (Top) node[pos = 0.66, above] (DW)  {$1-\varphi^{-}$};
    \draw[->] (Borrow) -- (Funds.center) node[pos = 0.66, above] (BFunds)  {$\varphi^{-}$};
    \draw[->] (Lend) -- (Bottom) node[pos = 0.3, below] (Overnight)  {$1-\varphi^{+}$};
    \draw[->] (Lend) -- (Funds.center) node[pos = 0.3, above] (LFunds)  {$\varphi^{+}$};
    %%
    \draw[dashed, red] ([xshift=-1cm]AverageBorrowing.center) -- +(2cm,0cm);
    \draw[dashed, red] ([xshift=-1cm]Funds.center) -- +(2cm,0cm);
    \draw[dashed, red] ([xshift=-1cm]AverageLending.center) -- +(2cm,0cm);
\end{tikzpicture}
\end{document}

在此輸入影像描述

相關內容