
Я рисую параметрический график с помощью pgfplots
и хочу добавить определенную точку на кривой. Я использовал addplot3
+ coordinates
, чтобы добавить определенный маркер на кривой в определенных координатах. Эта точка хорошо позиционирована (красного цвета). Теперь я хочу добавить определенный текст в эту точку с помощью \coordinate
окружения axis
. Я пробовал прямые координаты, axis cs
но ни одно не работает. Еще одна странность заключается в том, что в документации pgfplots написано (версия 1.16, раздел 4.17.1), что axis cs
это система координат по умолчанию в axis
окружении и ее можно опустить. Однако, если я удалю axis cs
точку, то она будет уже не та. Я уверен, что я что-то упускаю :-).
МВЭ:
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
%parameters
\pgfmathsetmacro{\vrotP}{pi/4}
\def\lengthb{4}
\def\lengthh{3}
\pgfmathsetmacro{\timeTot}{4*pi/\vrotP}
\pgfmathsetmacro{\timeMid}{\timeTot/2}
\pgfmathsetmacro{\timeRef}{7}
\begin{tikzpicture}[
declare function={%
theta(\t)=\vrotP*\t;
px(\t)=\lengthb*cos(theta(\t));
py(\t)=\lengthb*sin(theta(\t));
pz(\t)=-\lengthh*theta(\t);
}%
]
\begin{axis}[axis lines=center,
axis on top,
samples y=0,
trig format plots=rad,
xmax=5,
xmin=-5,
ymax=5,
ymin=-5,
zmin=-45,
zmax=0,
]
% \addplot[variable=t,domain=0:10,samples=50]{pz(t)};
\addplot3[blue,line width=2pt,variable=t,domain=0:\timeTot,samples=100]({px(t)},{py(t)},{pz(t)});
% point M
\addplot3+[red,only marks,line width=2pt] coordinates{({px(\timeRef)},{py(\timeRef)},{pz(\timeRef)})};
%
\pgfmathsetmacro{\tmpX}{px(\timeRef)}
\pgfmathsetmacro{\tmpY}{py(\timeRef)}
\pgfmathsetmacro{\tmpZ}{pz(\timeRef)}
\coordinate (orig) at (axis cs:0,0,0);
\coordinate (M) at (axis cs:\tmpX,\tmpY,\tmpZ);
\coordinate (Mp) at (\tmpX,\tmpY,\tmpZ);
\draw(orig)--(M);
\draw(orig)--(Mp);
\node[anchor=south] at (orig) {$O$};
\node[] at (M) {$M$};
\end{axis}
\end{tikzpicture}
\end{document}
Результат: