
를 사용하여 파라메트릭 플롯을 pgfplots
그리고 곡선에 특정 점을 추가하고 싶습니다. addplot3
+를 사용하여 coordinates
곡선의 특정 좌표에 특정 마커를 추가했습니다. 이 지점은 위치가 좋습니다(빨간색). 이제 \coordinate
환경을 사용하여 이 지점에 특정 텍스트를 추가하고 싶습니다 axis
. 직접 좌표를 시도했지만 axis cs
아무 것도 작동하지 않습니다. 또 다른 이상한 점은 pgfplots 문서에 환경 axis cs
의 기본 좌표계로 작성되어 있으며(버전 1.16, 섹션 4.17.1) axis
생략할 수 있다는 것입니다. 그러나 점을 제거하면 axis cs
동일하지 않습니다. 나는 뭔가를 놓치고 있다고 확신합니다 :-).
MWE:
\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}
결과: