
在下面的 MWE 中,如何更改label
與曲線關聯的垂直位置?例如,如果我想把它放在曲線下方?
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{tikzpicture}
\begin{axis} []
\addplot[
domain=10:400,
samples=100,
] { sqrt(x)}
node[pos=0.97,label={$f(x)$}] {}
;
\end{axis}
\end{tikzpicture}
\end{document}
答案1
您可以label=below:{$f(x)$}
照常使用。所有位置說明符(例如right
等left
below left
)都可以使用。另外,由於label
是節點,您也可以將其他選項傳遞給它,例如
label={[text=red]below:{$f(x)$}}
代碼:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\begin{document}
\begin{tikzpicture}
\begin{axis} []
\addplot[
domain=10:400,
samples=100,
] { sqrt(x)}
node[pos=0.97,label=below:{$f(x)$}] {}
;
\end{axis}
\end{tikzpicture}
\end{document}