TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wish to generate the following figure:

enter image description here

So far I have managed:


\begin{tikzpicture}[transition/.style = {rectangle,draw = black!50, fill = black!20, thick}]
\draw [>=stealth, ->](0,0) -- (0cm,-10cm) node[left, midway] {Depth};
\draw [>=stealth, ->](0cm,0cm) -- (10cm,0cm) node[above, midway] {Temperature [$^{o}$C]};
\draw[dashed] (1.99,0) -- (1.99,-10);
\draw (10,0).. controls (9.5,-2) and (8,-4) .. (7,-4) .. controls (5,-5) and (3,-7) .. (2.5,-8);

enter image description here

Where as you can see I am struggling with generating the curved line. It seems like there must be a better way of generating a line like this, other than the method I have chosen.

In addition, I am unsure of how to generate the rectangle in the middle of the diagram (when I try to do this, the rectangle appears in the top left hand corner of the page).

Furthermore, how can I specify the node 'Temperature' to be above the numbers? Note that I have scaled the diagram so that 20 on the diagram is equal to 10 cm, thus I can use this to space the values shown.

share|improve this question
up vote 6 down vote accepted

This curve you are trying to draw is a single Bezier curve.

The line between an endpoint of a Bezier curve and the corresponding control point is tangential to the curve in the endpoint. Thus, your control points must have the same x coordinate as the corresponding endpoints.

The length of the line segment between an endpoint and the corresponding control point determines "how long" the curve fill "follow" the control segment. Since your curve is symmetric, the control segments should be of equal length. Other than that, I have determined the y position of the control points experimentally below.



    transition/.style = {rectangle,draw = black!50, fill = black!20,thick},
\draw [>=stealth, ->](0,0) -- (0,-10) node[left, midway] {Depth};
\draw [>=stealth, ->](0,0) -- (42,0) node[above=7mm, midway] {Temperature [$^{o}$C]};
\foreach \x in {0,4,10,20} { \draw(\x,-2mm)--(\x,2mm) node[above]{\x};}
\draw[transition] (0,-6) rectangle (40,-2);
\draw[thick] (0,-4) -- (41,-4) node[anchor=west]{Thermocline};
\draw[dashed] (4,0) -- (4,-10);
\draw (4,-10) .. controls (4,-4)  and (18,-4) .. (18,0);

the Bezier curve

The rest of the code should be self-explanatory. The only big change from your original is that I have set the xy coordinate system, so the units used can be the actual physical units. (Well, I had no idea about the depth unit.)

share|improve this answer

Your Answer


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.