All I want to do is to rotate the axes of the accepted answer of the question in
How to draw and annotate a spherical coordinate system
such that the new z-axis stays where the current y-axis is.
My new axes (say, x', y' and z') should seem to be exactly where those xyz-axes are but with the following correspondences:
- z' <-- y
- y' <-- x
- x' <-- z
I don't want simply to change the axes' labels, because I want to work with the axis z' still being along the direction (0,0,1) and the angle theta must still come from it.
Stuff from How to draw and annotate a spherical coordinate system below:
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{60}{110}
%
\pgfmathsetmacro{\rvec}{.8}
\pgfmathsetmacro{\thetavec}{30}
\pgfmathsetmacro{\phivec}{60}
%
\begin{tikzpicture}[scale=5,tdplot_main_coords]
\coordinate (O) at (0,0,0);
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};
\tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec}
\draw[-stealth,color=red] (O) -- (P) node[above right] {$P$};
\draw[dashed, color=red] (O) -- (Pxy);
\draw[dashed, color=red] (P) -- (Pxy);
\tdplotdrawarc{(O)}{0.2}{0}{\phivec}{anchor=north}{$\phi$}
\tdplotsetthetaplanecoords{\phivec}
\tdplotdrawarc[tdplot_rotated_coords]{(0,0,0)}{0.5}{0}%
{\thetavec}{anchor=south west}{$\theta$}
\end{tikzpicture}
\end{document}
I couldn't to that with \tdplotsetmaincoords{}{} because that command only rotates around x-axis and then around the new z-axis (from the configuration showed below), and reaching my configuration requires a third rotation (like Euler angles) or rotation around y-axis.
This is a picture from Changing axes in tikz-3dplot picture (bobobobo's answer) showing the start configuration for rotations with tdplotsetmaincoords


