I'm making a TikZ picture in which I have a list of node names and coordinates and I want to go through the lists putting ith node name at the ith coordinate. My MWE:
\documentclass{beamer}
\usepackage{tikz}
\tikzstyle{arrow} = [thick,->]
\tikzstyle{aAllele} = [text opacity=0, circle,text centered, fill=blue, text=white, minimum size = 0.5cm]
\tikzstyle{bAllele} = [text opacity=0, circle, text centered, fill=red, text=white, minimum size = 0.5cm]
\begin{document}
\begin{frame}
\centering
\begin{tikzpicture}
\def\names{{24,23,33,22,32,11,21,31,41,00,10,20,30,40}}
\def\coords{(2,4),(2,3),(3,3),(2,2),(3,2),(1,1),(2,1),(3,1),(4,1),(0,0),(1,0),(2,0),(3,0),(4,0)}
\foreach \x in {0,1,2,3,4}{%
\foreach \y in {0,1,2,3,4}{%
\fill[red] (\x,\y) circle (0.25cm);%
}
}
\foreach \i in {0,...,14}{%
\node (\names[\i]) [aAllele] at \coords[\i] {};%
}
\end{tikzpicture}
\end{frame}
\end{document}
In this picture, the circles given by coords
should be colored blue. I'm using nodes because I'd eventually like to connect them with lines; I've already gotten it to work simply by iterating over the coordinates, however I need them to be named so I can use lines to connect them. Replacing lines 18-20 with the following:
\foreach \coord in \coords{%
\node (\coord) [aAllele] at \coord {};
}
compiles correctly, though isn't the desired result because I can't easily connect nodes by name (I think) because the nodes are given the "name" of the coordinates used to generate them.
Thanks
\coords
is wrong anyway\coords
, it seems to compile correctly, however then I don't get my node names. I edited the question to show this.