
¿Cómo podría escribir justo encima de las líneas azules de esta imagen tikz?
\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}
El resultado del código anterior:
Me gustaría algo así como "ABC" y "CBA" son de esta imagen.
Respuesta1
Úselo node[pos=0.5,sloped,above]
como en mi código a continuación. Explicación:
pos=0.5
coloca el nodo en el medio del camino,sloped
gira el texto para hacerlo paralelo a la pendiente del trazado en la posición en la que se inserta,above
se explica por sí mismo.
Tenga en cuenta que a su código le faltaba un punto y coma al final del tercer draw
comando.
\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}