带交叉箭头的图表

带交叉箭头的图表

我的问题是,我的图表中有交叉线/箭头,在搜索过程中,我找到了类似的答案这里这不适合我的问题。也许有人可以帮我解决这个问题。从公司到政府的箭头必须穿过中央银行和银行之间的箭头,但要以人们可以阅读文本的方式。是否可以将箭头放在不同的层上或其他地方?

\tikzset{
    %Define standard arrow tip
    >=stealth',
    %Define style for boxes
    punkt/.style={
           rectangle,
           rounded corners,
           draw=black, very thick,
           text width=6.5em,
           minimum height=3.5em,
           text centered}
}


\begin{tikzpicture}[node distance=1cm, auto, description/.style={fill=white,inner sep=2pt}]

 %nodes
 \node[punkt]                      (Banks)  {Banks ($B_b$)};
 \node[left=4cm of Banks]          (dummy1) {};
 \node[right=4cm of Banks]         (dummy2) {};
 \node[punkt, above=4cm of dummy1] (CB)     {CB};
 \node[punkt, below=4cm of dummy1] (Gov)    {Government};
 \node[punkt, above=4cm of dummy2] (Firms)  {Firms ($F_f$)};
 \node[punkt, below=4cm of dummy2] (HH)     {HH ($HH_{hh}$)};


\path[->, >=latex, thick]
  (Gov.20)      edge[] node[below, rotate=48]  {\small Bonds}                       (Banks.220)
  (Banks.200)   edge[] node[above, rotate=48]  {\small Deposits}                    (Gov.40)
  (Firms.250)   edge[] node[above, rotate=90]  {\small wage, dividends}             (HH.110)
  (HH.70)       edge[] node[below, rotate=90]  {\small equity, consumption}         (Firms.290)
  (Gov.350)     edge[] node[below]             {\small unempl. benefit}             (HH.190)
  (HH.170)      edge[] node[above]             {\small Taxes}                       (Gov.10)
  (CB.325)      edge[] node[below, rotate=-50] {\small interest, OSDF}              (Banks.160)
  (Banks.143)   edge[] node[above, rotate=-50] {\small interest, IDL, OMO, OSLF}    (CB.345)
  (Firms.200)   edge[] node[above, rotate=48]  {\small principal/interest payments} (Banks.40)
  (Banks.20)    edge[] node[below, rotate=48]  {\small Loans, interest}             (Firms.220)
  (HH.143)      edge[] node[above, rotate=-50]  {\small equity}                     (Banks.345)
  (Banks.325)   edge[] node[below, rotate=-50]  {\small interest, dividends}        (HH.160)
  (Banks.west)  edge[out=200, in=340, looseness=5] node[below]  {\small interbank loans} (Banks.east)
  (Firms.170)   edge[bend right=35]                node[above, near end, rotate=60]  {\small Taxes}               (Gov.120);
\end{tikzpicture}

在此处输入图片描述

答案1

我是一个喜欢简单解决方案的朋友:(1)绘制交叉边缘,(2)绘制半透明的白色矩形以使其在背景中淡出,(3)在其上方绘制其他东西。

\path[->, >=latex, thick](Firms.170)   edge[bend right=35]   node[above, near end, rotate=60]  {\small Taxes}               (Gov.120);

\path[fill=white, opacity=0.8] (-3.2,1) rectangle +(1.5,2);

\path[->, >=latex, thick]
  (Gov.20)      edge[] node[below, rotate=48]  {\small Bonds}                            (Banks.220)
[...]
  (Banks.west)  edge[out=200, in=340, looseness=5] node[below]  {\small interbank loans} (Banks.east);

在此处输入图片描述

答案2

使用层的替代方法background

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,positioning}
\usetikzlibrary{backgrounds}     %new code
\tikzset{
    %Define standard arrow tip
    >=stealth,
    %Define style for boxes
    punkt/.style={
           rectangle,
           rounded corners,
           draw=black, very thick,
           text width=6.5em,
           minimum height=3.5em,
           text centered}
}

\begin{document}
\begin{tikzpicture}[node distance=1cm, auto, description/.style={fill=white,inner sep=2pt}]

 %nodes
 \node[punkt]                      (Banks)  {Banks ($B_b$)};
 \node[left=4cm of Banks]          (dummy1) {};
 \node[right=4cm of Banks]         (dummy2) {};
 \node[punkt, above=4cm of dummy1] (CB)     {CB};
 \node[punkt, below=4cm of dummy1] (Gov)    {Government};
 \node[punkt, above=4cm of dummy2] (Firms)  {Firms ($F_f$)};
 \node[punkt, below=4cm of dummy2] (HH)     {HH ($HH_{hh}$)};


\path[->, >=latex, thick]
  (Gov.20)      edge[] node[below, rotate=48]  {\small Bonds}                       (Banks.220)
  (Banks.200)   edge[] node[above, rotate=48]  {\small Deposits}                    (Gov.40)
  (Firms.250)   edge[] node[above, rotate=90]  {\small wage, dividends}             (HH.110)
  (HH.70)       edge[] node[below, rotate=90]  {\small equity, consumption}         (Firms.290)
  (Gov.350)     edge[] node[below]             {\small unempl. benefit}             (HH.190)
  (HH.170)      edge[] node[above]             {\small Taxes}                       (Gov.10)
  (CB.325)      edge[] node[fill=white,below, sloped] {\small interest, OSDF}              (Banks.160)     %new code
  (Banks.143)   edge[] node[fill=white,above, sloped] {\small interest, IDL, OMO, OSLF}    (CB.345)        %new code
  (Firms.200)   edge[] node[above, rotate=48]  {\small principal/interest payments} (Banks.40)
  (Banks.20)    edge[] node[below, rotate=48]  {\small Loans, interest}             (Firms.220)
  (HH.143)      edge[] node[above, rotate=-50]  {\small equity}                     (Banks.345)
  (Banks.325)   edge[] node[below, rotate=-50]  {\small interest, dividends}        (HH.160)
  (Banks.west)  edge[out=200, in=340, looseness=5] node[below]  {\small interbank loans} (Banks.east);

\begin{scope}[on background layer]   %new code
   \path[->, >=latex, thick]  (Firms.170)   edge[bend right=35]                node[above, near end, rotate=60]  {\small Taxes}               (Gov.120);
\end{scope}
\end{tikzpicture}
\end{document}

在此处输入图片描述

范围路径位于主路径之后

相关内容