0

So…i made this graph using paint(!)…and it looks horrible. I have used tikz to create similar graphs but this one seems to be more difficult. Figure1

  • 5
    Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – jub0bs May 4 '14 at 11:47
  • 1
    yes you're right it was to good to be true…. – Stickyfingerz May 4 '14 at 11:52
  • Do you have any particular aversion to using a vector graphics editor such as Inkscape to create the diagram, exporting to EPS or PDF, and indluding it via \includegraphics or some similar? That would be my first approach, personally. – Joseph Montanaro Jan 15 '15 at 6:51
5

Here is one approach. Most parts are straightforward TikZ syntax. The somewhat unique parts of this drawing are the multipart nodes and the smooth curves, which I'll explain a bit more in this answer.

For the multipart nodes, I defined a style mysplit that's applied to each node we want to split. This avoids repeating yourself and ensures consistency in your drawing. The first node text is placed in the one subpart of the node, and following \nodepart{<part>} following text is placed in the <part> subpart of the node. Then later on we can refer to anchors of each specific subpart (the last two \draw commands).

Some people find the .. controls .. interface for creating Bézier curves too verbose for some curves (myself included). Here, I use to paths instead. Each part of the to path takes in and out parameters: the incoming and outgoing angle of the curve. These angles can be varied to produce different curves. The looseness parameter (default 1.0) is also adjustable.

Here's the full code:

\documentclass[tikz]{standalone}
\usetikzlibrary{shapes.multipart}
\tikzset{mysplit/.style={%
  draw,
  anchor=text,
  rectangle split,
  rectangle split horizontal,
  rectangle split parts=2,
}}

\begin{document}
\begin{tikzpicture}[align=left]
  \draw[looseness=0.7] (0.5,2.8) coordinate (OutMoney)
    to[out=-45,in=180] (3,1.5) coordinate (AtMoney)
    to[out=0,in=210] coordinate[pos=0.75] (InMoney) (6,2.8);
  \draw[dashed] (OutMoney) |- (3,0) -| (InMoney);
  \draw (AtMoney) -- (3,0) node[midway,fill=white] {At the money};
  \draw[thick] (0,3) node[below left] {Implied\\volatility} 
    |- (6,0) node[below] {Strike};
  \node[mysplit] (Out) at (-1.5,-2) {Out of the\\money\\put 
                                      \nodepart{two} 
                                     In the\\money\\call};
  \node[mysplit] (In)  at ( 4.5,-2) {In the\\money\\put 
                                      \nodepart{two} 
                                     Out of the\\money\\call};
  \draw (Out.one north) to[out=90,in=210] (1.25,1.5);
  \draw  (In.one north) to[out=90,in=-30] (4.25,1.25);
\end{tikzpicture}
\end{document}

And the 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.