3

I'm trying to play around with TikZ to recreate the following graph. I'm having trouble recreating the curved lines marked $\hat{sigma}=0$ and $\hat{e}=0$. I understand that I can use to[in=,out=], but nothing comes out looking remotely correct. Is there another way to draw curves in TikZ whose closed form equation I don't know? The rest of the graph isn't a problem for me.

Cycle

Here is my code for the one curve: What a mess!

\begin{figure}[H]
\centering
\begin{tikzpicture}[domain=0:10]
\draw[->] (0,0) -- (0,8) node[left]{$\pi$};
\draw[->] (0,0) -- (9,0) node[right]{$e$};
\draw (0,3) to[in=5,out=45] (5,4) to[in=45,out=80] (8,8);
\end{tikzpicture}
\caption{Skott model in $e-\sigma$}
\end{figure}
  • 2
    It would be useful to those willing to help if you posted the code of what you have already done. – Pier Paolo Apr 4 '14 at 20:09
  • In TikZ you can use controls parameter in \draw command. You could use more points for easier control. Or draw that curve in Inkscape and use inkscape2tikz converter and add the result to your main code. – Malipivo Apr 4 '14 at 20:14
  • Please always post complete code. That is much more useful than mere fragments. – cfr Apr 4 '14 at 21:28
  • Look at the hobby tikz library. – user11232 Apr 4 '14 at 23:23
  • You can use this site to extract the coordinates of the curve. Additionally you could do some polynomial fitting afterwards to get an smoother result. – Roald Aug 23 '16 at 20:46
3

If your aim is to just "give an idea" you could manually draw the curve by means of controls or plot specifications for the \draw command.

In the first case you define basically a Beziér curve assigning points such that the tangent to the curve in the first point is directed towards the second and the tangent in the last point is directed towards the one immediately before.

In the second case you specify points that belong to the curve; you can also adjust the final aspect imposing a different value for the tension option.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
  \draw [->] (0,0) -- (8,0);
  \draw [->] (0,0) -- (0,8);
  \draw [red,thick] (0,2) .. controls (4,2) and (6.5,3) .. (7,7);%<-- This is the first important part
  \foreach \xred/\yred in {0/2,4/2,6.5/3,7/7} {
    \node [circle,fill=red,draw=none,opacity=0.5,minimum size=4pt,inner sep=0] (node\xred-\yred) at (\xred,\yred) {};
    \node [align=center,text width=5cm] (redbox) at (8,1) {Control points for the {\color{red}red} curve.};
    \draw [->,red,shorten >=2pt,dashed] (redbox) -- (\xred,\yred);
  }
  \draw [blue,thick] plot [smooth] coordinates {(0,6) (6,5) (4,3) (6,2)};%<-- This is the other important part
  \foreach \xblue/\yblue in {0/6,6/5,4/3,6/2} {
    \node [circle,fill=blue,draw=none,opacity=0.5,minimum size=4pt,inner sep=0] (node\xblue-\yblue) at (\xblue,\yblue) {};
    \node [align=center,text width=5cm] (bluebox) at (3,8) {These points belong to the ({\color{blue}blue}) curve they define.};
    \draw [->,blue,shorten >=2pt,dashed] (bluebox) -- (\xblue,\yblue); 
  }
\end{tikzpicture}
\end{document}

enter image description here

1

It looks like the only problem is that you've confused the syntax of the in and out keys. Setting out=<angle> specifies the angle of the tangent line to the curve leaving the previous coordinate, while in=<angle> specifies that of the curve arriving at the next coordinate. Note that 0 degrees is always aligned with the current in-scope x-coordinate.

Code

\documentclass{standalone}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}[domain=0:10]
\draw[->] (0,0) -- (0,8) node[left]{$\pi$};
\draw[->] (0,0) -- (9,0) node[right]{$e$};
\draw (0,3) to[in=210,out=0] (5,4) to[in=250,out=30] (8,8);
\end{tikzpicture}
\end{document}

Output

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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