I'm trying to draw a set of 64 disks on a grid 8x8. Like this figure: enter image description here

I have so far:

enter image description here

I want to automate this task with a for loop for example, I dont know. See my code, this is brutal force code, one line for each disk


\draw[step=.5cm,gray,very thin] (-2.0,-2.0) grid (2.0,2.0);
\draw (-1.75,1.75) circle (0.15cm);
\draw (-1.25,1.75) circle (0.15cm);
\draw (-0.75,1.75) circle (0.15cm);
\draw (-0.25,1.75) circle (0.15cm);
\draw (0.25,1.75) circle (0.15cm);
\draw (0.75,1.75) circle (0.15cm);
\draw (1.25,1.75) circle (0.15cm);
\draw (1.75,1.75) circle (0.15cm);
  • See the manual page 901 bottom. If your manual contains less than 1161 pages, that is the wrong one.
    – Symbol 1
    Apr 28, 2017 at 22:01
  • @Symbol1 It's talking about calendars. pgf.sourceforge.net/pgf_CVS.pdf Apr 28, 2017 at 22:14
  • Welcome to TeX.SX! What you're looking for is the \foreach command! Note that you might want to use the optional argument help lines when drawing the grid instead of gray,very thin: it's semantically more correct even if result is the same.
    – ebosi
    Apr 28, 2017 at 22:15
  • @AndreyFrança Page 892 then
    – Symbol 1
    Apr 28, 2017 at 22:16

1 Answer 1


This is quite easy if you look a bit into the manual. At the end of Page 901 of the pgfmanual verion 3.0.1a, you find a similar pattern of circles as pointed out by @Symbol1. The remaining tiks and labels are basic easy sruff.


\begin{tikzpicture}[line width=.7pt, outer sep=0pt]
\foreach \x in {1,...,8}
  \foreach \y in {1,...,8}
    \draw [fill=red](\x,\y) circle (0.3cm);
\node [minimum size=8.2cm,draw](o) at (4.5,4.5){};

\node at (o.north) [above]{$N=64, \eta=0.3$};
\node at (o.south) [below=1em]{eixo x};
\node at (o.west)  [left=2.5em,rotate=90]{eixo y};

\foreach \i  in {0,0.2,0.4,0.6,0.8,1.0}{
  \draw ($(o.south west)!\i!(o.south east)$)node[below]{\i}--++(0,2mm);
  \draw ($(o.south west)!\i!(o.north west)$)node[left]{\i}--++(2mm,0);

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .