I'm trying to draw a stack of arrows at different angles in a \foreach
loop in TikZ. I don't want to have to declare every z coordinate and angle manually so I was using the {1,2,...,10}
syntax but this doesn't seem to work in the example below with two variables in the for loop.
\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{arrows}
\usetikzlibrary{3d}
\tikzset{>=latex}
\begin{document}
\tdplotsetmaincoords{90}{90}
\tdplotsetrotatedcoords{0}{20}{70}
\begin{tikzpicture}[tdplot_rotated_coords,scale=0.5]
\foreach \x/\y in {7/0, 8/10, ..., 10/30}
{
\draw (2, 2, \x) circle(2) node[right]{\y};
\draw[->, ultra thick, red] (2, 2, \x) --++ (\y:2) --++ (\y+180:4);
}
\end{tikzpicture}
\end{document}
Does anyone know how to get around this? The code above gives the error ! Illegal unit of measure (pt inserted).
Thanks.
tikz
seems unable to "fill in the gaps" associated with...
.\x
and\y
expressable using a formula?\x
only and computing\y
with\pgfmathtruncatemacro{\y}{10*(\x-7)}
seems to work. Can this be applied to your original problem as well?