我正在尝试使用 Tikz 绘制下图,但在绘制角度时遇到困难phi
。
正如您在下面看到的,角度有问题。:
\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{calc,patterns}
\begin{document}
\begin{center}
\begin{tikzpicture}
\coordinate (origo) at (0,0);
\coordinate (pivot) at (1,-1);
\coordinate (point) at (1,2);
\draw [->] (origo) -- (-2,-2) node (x) [below] {$x$};
\draw [->] (origo) -- (3,0) node [right] {$y$};
\draw [->] (origo) -- (0,3) node [above] {$z$};
\draw [dashed,-] (origo) -- (pivot) node (r) [pos = 0.5, anchor = south west] {$r$};
\draw [dashed,-] (pivot) -- (point) node [pos = 0.6, anchor = west] {$z$} node [circ] {} node [thick,above] {$P$};
\pic [draw, ->, "$\theta$", angle eccentricity=1.5] {angle = x--origo--r};
\end{tikzpicture}
\end{center}
\end{document}
结果
答案1
像这样?与您的代码略有不同。
\documentclass[margin=3mm]{standalone}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{arrows,chains,shapes.geometric,shapes,angles,quotes}
\begin{document}
\tdplotsetmaincoords{60}{115}
\begin{tikzpicture}
[scale=0.9,
tdplot_main_coords,
axis/.style={-latex,thick,color=gray},
vector/.style={-stealth,red,very thick},
vector guide/.style={dashed,thick,color=cyan}]
%standard tikz coordinate definition using x, y, z coords
% A(2,4,3), B(3,-1,4)
\def\Ax{1.5}
\def\Ay{1.5}
\def\Az{2.5}
\coordinate (O) at (0,0,0);
\coordinate (A) at (\Ax,\Ay,\Az);
%draw axes
\draw[axis] (0,0,0) -- (3,0,0)coordinate(X) node[anchor=north east]{$x$};
\draw[axis] (0,0,0) -- (0,2.5,0) node[anchor=north west]{$y$};
\draw[axis,color=black] (0,0,0) -- (0,0,2.75) node[anchor=south]{$z$};
%draw a vector from O to A and O to B
\filldraw[cyan] (A)circle (2pt)node[right]{$P(r,\theta,z)$};
\draw [vector guide] (O)--(1.5,1.5,0)node[midway,left]{$r$};
\draw [vector guide] (A)--(1.5,1.5,0)coordinate (xy)node[midway,left,anchor=south east]{$z$};
\pic["$\theta$", draw=orange, -latex,thick, angle eccentricity=1.5, angle radius=0.7cm]{angle=X--O--xy};
\end{tikzpicture}
\end{document}