Tikz实现文字沿路径摆放
tikz
的 decorations.text
库可实现文字沿路径摆放等文字效果,见下例:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\newlength{\mylt}
\newlength{\mytop}
\setlength{\mylt}{1.5cm}
\setlength{\mytop}{-1cm}
\draw [dashed, postaction={decorate,decoration={text along path,text align=center,text={Overall influence curve}}}] (\mylt,\mytop) .. controls (\mylt+4cm,\mytop-5cm) and (\mylt+8cm,\mytop-5cm) .. (\mylt+15cm,\mytop-2cm);
\begin{scope}[yshift=1cm]
\draw [dashed, postaction={decorate,decoration={text along path,text align={left, left indent=1cm}, text={Overall influence curve}}}] (\mylt,\mytop) .. controls (\mylt+4cm,\mytop-2cm) and (\mylt+8cm,\mytop-2cm) .. (\mylt+15cm,\mytop-2cm);
\end{scope}
\begin{scope}[yshift=2cm]
\draw[yshift=-3mm] (\mylt,\mytop) .. controls (\mylt+4cm,\mytop-2cm) and (\mylt+8cm,\mytop-2cm) .. (\mylt+15cm,\mytop-2cm);
\path [postaction={decorate,decoration={text along path,text align={right,right indent=4cm}, text={Overall influence curve}}}] (\mylt,\mytop) .. controls (\mylt+4cm,\mytop-2cm) and (\mylt+8cm,\mytop-2cm) .. (\mylt+15cm,\mytop-2cm);
\end{scope}
\end{tikzpicture}
\end{document}