
Ich verwende die decorations.text
Bibliothek, um Text entlang eines Pfades zu setzen, der vonpgfplots
. Die Dekoration funktioniert gut, ohne Spuren zu hinterlassen, wie indiese Antwort, aber mit Markierungen auf dem Pfad schlägt die Kompilierung mit fehl Package pgf Error: I cannot decorate an empty path \end{axis}
. Warum und gibt es eine Problemumgehung?
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[
no markers,
decoration={
text along path,
text={This is my path},
},
postaction={decorate},
] coordinates {(0,0) (10,1)};
% \addplot+[
% mark=*,
% decoration={
% text along path,
% text={This is my path},
% },
% postaction={decorate},
% ] coordinates {(0,1) (10,0)}; %This one fails
\end{axis}
\end{tikzpicture}
\end{document}
Antwort1
Sie können das Problem beheben, indem Sie die Dekoration der Markierungen wie folgt deaktivieren mark options={decoration={name=none}}
:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[
no markers,
decoration={
text along path,
text={This is my path},
},
postaction={decorate},
] coordinates {(0,0) (10,1)};
\addplot+[
mark=*,
decoration={
text along path,
text={This is my path},
},
mark options={decoration={name=none}},
postaction={decorate},
] coordinates {(0,1) (10,0)}; %This one fails
\end{axis}
\end{tikzpicture}
\end{document}