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 am trying to recreate this image from a presentation:

enter image description here

I got part of the way there with the following:

\begin{center}
\begin{tikzpicture}
\draw[<->] (0,5) node[left]{price}-- (0,0) -- (8,0) node[below] {time};
\draw[thick] (0, 4) -- (1.5, 4) ;
\draw[thick] (1.5, 4) -- (1.5, 2) ;
\draw[thick, domain=0:4] plot({\x+1.5},{(4 - (2 * exp(-\x/2)))}) ;
\draw[thick] (5.5, 3.73) -- (8, 3.73) ;
\end{tikzpicture}
\end{center}

But it's unclear to me how to add the remaining labels and arrows. Any suggestions?

share|improve this question
add comment

1 Answer

up vote 11 down vote accepted

By doing all lines on one path you can improve the corners.

The rest is just adding nodes at the appropriate corners. I set the “pre-trade” node above the graph, similar to the post one to have a better consistency.

The LaTeX-wide knows macro \\ does only work in a node if the align key is set.

Note that I added three coordinates to the path:

  • pre,
  • low, and
  • post

which are later used to extract the y values for the arrows. This way, if you change something in your graph, you don’t need to adjust the arrows.

Additionally I used another macro \arrowlength that specifies the length of the arrow as it is used a few times on the arrow path. I macro-ized the x value of the arrow bar/link in the same way.

Code

\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{calc}
\newcommand*{\arrowBar}{9cm}
\newcommand*{\arrowlength}{.5cm}
\begin{document}
\begin{tikzpicture}[every node/.style={font=\tiny}]
\draw[<->,every node/.style={font=\normalsize}] (0,5) node[left]{price} -- (0,0) -- (8,0) node[below] {time};
\draw[thick] (0, 4) -- (1.5, 4)  node[midway, above, align=center]        {pre-trade\\equilibrium}
                        coordinate (pre)
                    -- (1.5, 2)  node[left,midway,align=right]            {200 shares\\sold}
                                 node[right]                              {trade print}
                                 coordinate (low)% this coordinate could have been produced with the preceding node too
                    -- plot[domain=0:4]({\x+1.5},{(4 - (2 * exp(-\x/2)))}) 
                    -- (5.5, 3.73)
                    -- (8, 3.73) node[midway,above]                       {post-trade equilibrium}
                                 coordinate (post);

\tikzset{every node/.append style={right, align=left}}
\draw[<->] let \p1=(pre), \p2=(low), \p3=(post) in
       (\arrowBar-\arrowlength,\y1)
    -| (\arrowBar,\y3)
       node[pos=.75] {permanent\\impact}
    |- (\arrowBar-\arrowlength,\y2)
       node[pos=.25] {temporary\\impact};
\draw[ ->] let \p3=(post) in
       (\arrowBar,\y3) -- ++ (-\arrowlength,0);
\end{tikzpicture}
\end{document}

Output

enter image description here

share|improve this answer
    
Thanks! That's excellent. –  Shane Dec 28 '12 at 12:02
add comment

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.