I'm trying to create a simple spherical quadrant grid using the tikz-3dplot
package. The longitudinal grid lines look fine but when I try to create the latitudinal lines I get really strange results that I don't understand. I was expecting to see a series of latitude arcs rotating around the x-axis (so they're not quite the same as latitude lines). Instead, it appears that my attempt to rotate around the x-axis is rotating around all three axes. I'm not sure what I'm doing wrong.
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{60}{155}
\usetikzlibrary{3d}
\begin{tikzpicture}[scale=5,tdplot_main_coords]
\tikzstyle{grid}=[thin,color=red,tdplot_rotated_coords]
\draw[thick,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};
\draw[thick,->] (0,0,0) -- (-1,0,0);
\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$};
\foreach \rot in {0, 30, 60, 90} {
\tdplotsetrotatedcoords{\rot}{0}{0};
\tdplotdrawarc[grid]{(0,0,0)}{1}{0}{180}{}{};
}
\foreach \rot in {-90, -60, -30, 0, 30, 60, 90} {
\tdplotsetrotatedcoords{\rot}{90}{0};
\tdplotdrawarc[grid]{(0,0,0)}{1}{90}{180}{}{};
}
\end{tikzpicture}
\end{document}
Edit:
After more investigation it appears that attempting to rotate around the x-axis actually rotates around the z-axis, as can be clearly seen in this image. Placing the \rot
in the x- or z-position has the same effect.
{}
symbol which will apply the code formatting (which is just indentation) rather then enter HTML. Also, while code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the\documentclass
and the appropriate packages so that those trying to help don't have to recreate it. This is especially important fortikz
as there are numerous libraries.