Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to trace this figure, but I have difficulties in controlling the placement of arrows and numerical flows underneath the arrows.

enter image description here

The "sedimentary rock" node has to be split in two. Can you support some help. Thanks in advance.

\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}
share|improve this question
    
If you indent your code by four spaces, or surround it in <pre> and </pre> tags, then it will be formatted as code rather than as plain text. –  I Like to Code Jan 18 at 18:00

2 Answers 2

up vote 12 down vote accepted

In the following solution I address both problems: the split node and the text along the curved paths.

\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}

enter image description here

Some remarks:

  1. I defined a mynode style for all the nodes with colored background.

  2. I used the positioning library to place the nodes

  3. The "split" node is simply a wider node called rochas with the mynode style; two \parboxes were used to place the text on each part of the node; a dashed line from rochas.north to rochas.south produces the separation. Finally, the text "Sedimentary rocks" is written using an auxiliary node (to prevent the dashed line from overwriting the text).

  4. The text along the curved paths was written using the text along path decoration from the decorations.text library (See Section 30.6 Text Decorations of the pgf manual). I used the style defined by percusse in his answer to Curved text (on multiple lines) within curved arrow using tikz.

  5. Notice that placing mathematical expressions using this decoration requires some extra precautions; even a simple expression such as $3\times 10^{14}$ has to be written as $3{\times} 10{^{14}}${}; in particular, the pair of final braces is required (try seeing what happens if you suppress it).

share|improve this answer
    
It's great. Now I know a way to represent several diagrams like that. Many thanks for this magnificent solution. –  Jorge Jan 18 at 23:36
    
@Jorge You're welcome! I'm glad I could help. –  Gonzalo Medina Jan 18 at 23:52

This is a partial answer that shows you how to split the "Sedimentary rocks" node into two. I define a custom rock style for each rectangle. This makes it easy to make the rectangles adopt a uniform style. The way I draw the "Sedimentary rocks" node is by drawing two different rocks which I place together, then drawing the dashed line and adding the "Sedimentary rocks" label relative to the anchors of the rocks nodes.

\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}

enter image description here

See Chapter 5 of the pgfmanual for more information about the techniques which I used in this answer.

share|improve this answer
    
I appreciate the efforts. –  Jorge Jan 18 at 23:38
    
You're welcome. :-) –  I Like to Code Jan 19 at 0:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.