5

How could I write just above the blue lines of this tikzpicture?

\begin{tikzpicture}[
    scale=5,
    IS/.style={blue, thick},
    LM/.style={red, thick},
    axis/.style={very thick, ->, >=stealth', line join=miter},
    important line/.style={thick}, dashed line/.style={dashed, thin},
    every node/.style={color=black},
    dot/.style={circle,fill=black,minimum size=4pt,inner sep=0pt,
        outer sep=-1pt},
]
% axis
\draw[axis,-] (2.5,0) node(xline)[right] {$O_B$} -|
                (0,2.5) node(yline)[left] {$w$};
\draw[axis,-](2.5,0)--(2.5,2.5);
 \node (0,0) [left]{$O_A$};
  \draw[-, Blue] (0,2)--(1.4,.6)
\draw[-, Blue] (2.5,2)--(.8,.6);
   \draw[dashed] (0,.87) node[left] {$w_0^*$}--(2.5,.87) node[right] {$w_0^*$};
  \node[dot,label=above:$\epsilon_0$] at (1.13,.87) (int1) {};
\draw[dashed] (1.13,0) node[below]{$E_0$}--(1.13,0.87);
\end{tikzpicture} 

The result of the code above: enter image description here

I would like something like as the "ABC" and "CBA" are from this picture.

this picture

Y_gr
  • 3,322
  • It would be good if you can post a compilable minimal working example. Since I cannot compile your code I just suggest you look at the 'midway' and 'above' in the node definition, as suggested here: http://tex.stackexchange.com/a/39794/828 – Habi May 27 '13 at 08:30

1 Answers1

10

Use node[pos=0.5,sloped,above] as in my code below. Explanation:

  • pos=0.5 places the node in the middle of the path,
  • sloped rotates the text to make it parallel to the slope of the path at the position it's inserted,
  • above is self-explanatory.

Note that your code was missing a semicolon at the end of the 3rd draw command.

enter image description here

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}[%
    scale=5,%
    IS/.style={blue, thick},%
    LM/.style={red, thick},%
    axis/.style={very thick, ->, >=stealth', line join=miter},%
    important line/.style={thick}, dashed line/.style={dashed, thin},%
    every node/.style={color=black},%
    dot/.style={circle,fill=black,minimum size=4pt,inner sep=0pt,%
        outer sep=-1pt},%
]
% axis
    \draw[axis,-]   (2.5,0) node(xline)[right]  {$O_B$} -|
                    (0,2.5) node(yline)[left]   {$w$};
    \draw[axis,-]   (2.5,0) --  (2.5,2.5);
    \node (0,0) [left]{$O_A$};
    \draw[-, blue] (0,2)--(1.4,.6) node[pos=0.5,sloped,above] {$foo$};
    \draw[-, blue] (2.5,2)--(.8,.6) node[pos=0.5,sloped,above] {$bar$};
    \draw[dashed] (0,.87) node[left] {$w_0^*$} -- (2.5,.87) node[right] {$w_0^*$};
    \node[dot,label=above:$\epsilon_0$] at (1.13,.87) (int1) {};
    \draw[dashed] (1.13,0) node[below]{$E_0$}--(1.13,0.87);
\end{tikzpicture}
\end{document}
jub0bs
  • 58,916