弯曲箭头上方和下方的文字

弯曲箭头上方和下方的文字

我想追踪这个图形,但是我无法控制箭头的位置和箭头下方的数字流。

在此处输入图片描述

“沉积岩”节点必须一分为二。您能提供一些帮助吗?提前致谢。

\documentclass[tikz]{minimal}
\usepackage{tikz}
\usetikzlibrary{shapes}

\begin{document}
\begin{tikzpicture}

\node[rectangle,fill=red!70,text width=4cm,anchor=base]  (atmosfera) at (5cm, 8cm) {Atmosphere\\ (carbon dioxide)};
\node[rectangle,fill=red!70,text width=4cm,anchor=base]  (biosfera) at (0cm, 2.5cm) {Biosphere\\ (carbohydrates)};
\node[rectangle,fill=red!70,text width=4cm,anchor=base]  (oceano) at (8cm, 0cm) {Ocean\\(bicarbonate ions)\\ $1.3\times10^{20}$};
\node[rectangle,fill=red!70,text width=4cm,anchor=base]  (rochas) at (0cm, 0cm) {Sedimentary rocks};

\draw[->,out=-90,in=0,looseness=1, draw=blue]  (atmosfera.south west) to node[midway, above, sloped] {Photosynthesis} (biosfera.east) ;

\draw[->,out=90,in=180,looseness=1, draw=blue]  (biosfera.north) to node[midway, above, sloped] {Respiration and decay\\$10^{17}$} (atmosfera.west) ;

\draw[->,out=-90,in=90,looseness=1, draw=blue]  (biosfera.west) to node[midway, above, sloped] {Burial\\ $3 \times 10^{14}$} (rochas.west) ;

\draw[->,out=90,in=-90,looseness=1, draw=blue]  (rochas.north) to node[midway, above, sloped] {Vulcanism and weathering} (atmosfera.south) ;

\draw[->,out=90,in=120,looseness=1, draw=blue]  (rochas.south east) to node[midway, above, sloped] {$10^{15}$} (oceano.north west) ;

\draw[->,out=.120,in=-60,looseness=1, draw=blue]  (oceano.south) to node[midway, above, sloped] {Sedimentation} (rochas.west) ;

\draw[->,out=-90,in=90,looseness=1, draw=blue]  (atmosfera.south) to node[midway, above, sloped] {Solution} (oceano.north) ;

\draw[->,out=90,in=0,looseness=1, draw=blue]  (oceano.east) to node[midway, above, sloped] {Evaporation} (atmosfera.east) ;
\end{tikzpicture}
\end{document}

答案1

在下面的解决方案中我解决了这两个问题:分割节点和沿弯曲路径的文本。

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,decorations.text}

\begin{document}

\begin{tikzpicture}[
mynode/.style={rectangle,
  fill=orange!70,
  text width=4cm,
  align=center,
},
mypostaction/.style 2 args={
  decoration={
    text align={
      left indent=#1},
      text along path, 
      text={#2}
    },
  decorate
},
>=latex
]

\node[mynode]  (atmosfera)  
  {Atmosphere\\ (carbon dioxide)};
\node[mynode,below left= 2cm and 3cm of atmosfera]  (biosfera) 
  {Biosphere\\ (carbohydrates)};
\node[mynode,below right= 7cm and 0cm of atmosfera]  (oceano)  
  {Ocean\\(bicarbonate ions)\\ $1.3\times10^{20}$};
\node[mynode,text width=6cm,below left= 7cm and 0cm of atmosfera]  (rochas)  {\phantom{A} \\ \parbox[t]{3cm}{\centering (organic carbon) \\ $6\times 10^{22}$ }\parbox[t]{3cm}{\centering (carbonates) \\ $3\times 10^{23}$}};

\draw[ultra thick,dashed,white] (rochas.north) -- (rochas.south);
\node[anchor=north] at (rochas.north) {Sedimentary rocks};

\draw[->,thick,cyan]  (atmosfera.210) to[out=-100,in=0,looseness=1]  (biosfera.east) ;
\path[postaction={mypostaction={1cm}{Photosynthesis}, /pgf/decoration/raise=1.5mm}]  (biosfera.east) to[out=0,in=-100,looseness=1]  (atmosfera.210);
\path[postaction={mypostaction={2cm}{$10{^{17}}${}}, /pgf/decoration/raise=-4mm}]  (biosfera.east) to[out=0,in=-100,looseness=1]  (atmosfera.210);

\draw[->,thick,cyan]  (biosfera.140) to[out=90,in=180,looseness=0.8]  (atmosfera.west) ;
\path[postaction={mypostaction={1cm}{Respiration and decay}, /pgf/decoration/raise=1.5mm}]  (biosfera.140) to[out=90,in=180,looseness=0.8]  (atmosfera.west);
\path[postaction={mypostaction={2.3cm}{$10{^{17}}${}}, /pgf/decoration/raise=-4mm}]  (biosfera.140) to[out=90,in=180,looseness=0.8]  (atmosfera.west);

\draw[->,thick,cyan]
  (atmosfera.330) to[out=-90,in=150,looseness=0.5]  (oceano.140) ;
\path[postaction={mypostaction={3cm}{Solution}, /pgf/decoration/raise=1.5mm}]  
  (atmosfera.330) to[out=-90,in=150,looseness=0.5]  (oceano.140);
\path[postaction={mypostaction={3cm}{$4{\times} 10{^{17}}${}}, /pgf/decoration/raise=-4mm}]  
  (atmosfera.330) to[out=-90,in=150,looseness=0.5]  (oceano.140);

\draw[->,thick,cyan]  
  (oceano.40) to[out=80,in=0]  (atmosfera.east) ;
\path[postaction={mypostaction={4cm}{Evaporation}, /pgf/decoration/raise=1.5mm}]  
  (atmosfera.east) to[out=0,in=80]  (oceano.40);
\path[postaction={mypostaction={4.3cm}{$4{\times} 10{^{17}}${}}, /pgf/decoration/raise=-4mm}]  
  (atmosfera.east) to[out=0,in=80]  (oceano.40);

\draw[->,thick,cyan]  
  (biosfera.220) to[out=-80,in=130]  (rochas.145) ;
\path[postaction={mypostaction={2cm}{Burial}, /pgf/decoration/raise=1.5mm}]  
  (rochas.145) to[out=130,in=-80]  (biosfera.220);
\path[postaction={mypostaction={2cm}{$3{\times} 10{^{14}}${}}, /pgf/decoration/raise=-4mm}]  
  (rochas.145) to[out=130,in=-80]  (biosfera.220);

\draw[->,thick,cyan]  
  (rochas.75) to[out=80,in=-80]  (atmosfera.south) ;
\path[postaction={mypostaction={2cm}{Vulcanism and weathering}, /pgf/decoration/raise=1.5mm}]  
  (rochas.75) to[out=80,in=-80]  (atmosfera.south);
\path[postaction={mypostaction={3.5cm}{$3{\times} 10{^{14}}${}}, /pgf/decoration/raise=-4mm}]  
  (rochas.75) to[out=80,in=-80]  (atmosfera.south);

\draw[->,thick,cyan]  
  (rochas.20) to[out=80,in=130,looseness=0.8]  (oceano.170) ;
\path[postaction={mypostaction={3cm}{$10{^{15}}${}}, /pgf/decoration/raise=1.5mm}]  
  (rochas.20) to[out=80,in=130,looseness=0.8]  (oceano.170);

\draw[->,thick,cyan]  
  (oceano.250) to[out=-90,in=-40,looseness=0.8]  (rochas.-20) ;
\path[postaction={mypostaction={3cm}{Sedimentation}, /pgf/decoration/raise=1.5mm}]  
  (rochas.-20) to[out=-40,in=-90,looseness=0.8]  (oceano.250);
\path[postaction={mypostaction={3.5cm}{$10{^{15}}${}}, /pgf/decoration/raise=-4mm}]  
  (rochas.-20) to[out=-40,in=-90,looseness=0.8]  (oceano.250);
\end{tikzpicture}

\end{document}

在此处输入图片描述

一些评论:

  1. mynode为所有具有彩色背景的节点定义了一种样式。

  2. 我使用positioning库来放置节点

  3. “分割”节点只是一个更宽的节点,使用rochas样式mynode调用;两个节点\parboxes用于将文本放置在节点的每个部分;一条从 到 的虚线rochas.north产生rochas.south分离。最后,使用辅助节点写入文本“沉积岩”(以防止虚线覆盖文本)。

  4. 沿着弯曲路径的文本是使用库text along path decoration中的文本编写的decorations.text(参见第节30.6 文本修饰手册pgf)。我使用了由敲击他的回答使用 tikz 在弯曲箭头内绘制弯曲文本(多行)

  5. 请注意,使用此修饰来放置数学表达式需要一些额外的预防措施;即使是一个简单的表达式,例如也$3\times 10^{14}$必须写成$3{\times} 10{^{14}}${};特别是,最后的一对括号是必需的(试着看看如果你抑制它会发生什么)。

答案2

这是部分答案,向您展示了如何将“沉积岩”节点拆分为两个。我rock为每个矩形定义了一个自定义样式。这样可以轻松地使矩形采用统一的样式。我绘制“沉积岩”节点的方式是绘制两个不同的节点,将它们rocks放在一起,然后绘制虚线并添加相对于节点锚点的“沉积岩”标签rocks

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{tikzpicture}[rock/.style={rectangle,
    minimum width=35mm,
    minimum height=20mm,
    text width=3cm,
    align=center,
    }]
  \node[rock] (orgcar) at (0,0)
      {~\\~\\(organic carbon)\\$6 \times 10^{22}$};
      \node[rock,anchor=west] (carbon) at (orgcar.east) 
      {~\\~\\(carbonates)\\$3 \times 10^{23}$};
  \draw[very thick,dashed,black!20!white]
      (orgcar.north east) -- (orgcar.south east);
  \node[anchor=north,yshift=-2mm] at (orgcar.north east)
      {Sedimentary rocks};
\end{tikzpicture}
\end{document}

在此处输入图片描述

有关我在该答案中使用的技术的更多信息,请参阅 pgfmanual 的第 5 章。

相关内容