
を使用してパラメトリック プロットを描画しpgfplots
、曲線上に特定のポイントを追加したいと考えています。addplot3
+を使用してcoordinates
、特定の座標で曲線上に特定のマーカーを追加しました。この点は適切に配置されています (赤で表示)。ここで、環境を使用してこの点に特定のテキストを追加したいと思います。直接座標を試しましたが、どれも機能しません。さらに奇妙なのは、pgfplots のドキュメントに、\coordinate
環境の既定の座標系であり省略可能であると記載されていることです (バージョン 1.16、セクション 4.17.1)。ただし、ポイントを削除すると同じではありません。何かが欠けているのは確かです :-)。axis
axis cs
axis cs
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}
結果: