Как разместить текст вдоль пути с помощью 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}

Связанный контент