マーク付きの pgfplots を使用してパスに沿ってテキストを配置するにはどうすればよいですか?

マーク付きの pgfplots を使用してパスに沿ってテキストを配置するにはどうすればよいですか?

私はdecorations.textライブラリを使用して、描画されたパスに沿ってテキストを設定しています。pgfplots装飾はマークなしでも問題なく機能します。この答えですが、パスにマークが付いていると、コンパイルが失敗しますPackage pgf Error: I cannot decorate an empty path \end{axis}。なぜでしょうか。回避策はありますか。

\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}

答え1

次のコマンドを使用してマークの装飾を無効にすることで問題を解決できます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}

関連情報