
이 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}
위 코드의 결과:
이 사진에 나오는 "ABC"와 "CBA" 같은 것을 원합니다.
답변1
node[pos=0.5,sloped,above]
아래 코드와 같이 사용하십시오 . 설명:
pos=0.5
노드를 경로 중앙에 배치하고,sloped
삽입된 위치에서 경로의 경사와 평행이 되도록 텍스트를 회전합니다.above
자명하다.
코드의 세 번째 명령 끝에 세미콜론이 누락되었습니다 draw
.
\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}