# How to draw a “halftone” spiral made of circles in LaTeX?

I would like to use LaTeX to draw a spiral like the one below, but it's way out of my league. Any help would be much appreciated.

NEW EDIT: (now with a better 3d look!) after playing a bit with Jasper Habicht's solution, this was the best I could get up to now. I'm pretty happy. Thank you!

My customized version of Jasper Habicht's solution! (Give him a “up” vote!)

% Credits to Jasper Habicht (See below)
\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}

\definecolor{mygreencolor}{RGB}{133,196,96}

\begin{tikzpicture}

\pgfmathsetmacro\inner{10}
\pgfmathsetmacro\outer{40}
\pgfmathsetmacro\range{\outer-\inner}

\foreach \stepy in {\inner, ..., \outer}
\pgfmathsetmacro\stepstart{60/\stepy}
\pgfmathsetmacro\steplast{360-\stepstart}
\pgfmathsetmacro\stepcount{floor(360/\stepstart)}
\foreach \stepx in {0, \stepstart, ..., \steplast}
\pgfmathsetmacro\stepsingle{floor(\stepx/\stepstart)}
\pgfmathsetmacro\mybase{90*(\stepy-\inner)/\range)}
\pgfmathsetmacro\mycoef{((1-cos(\mybase)+sin(\mybase))/2}
\pgfmathsetmacro\mystepy{\inner+\range*\mycoef}
\fill[mygreencolor] ({-(\stepx+.25*\stepcount)}:-\mystepy mm) circle (\stepradius mm);

\end{tikzpicture}

\end{document}


A different approach that also needs a lot of fine tuning.

What does it do? It draws several rings consisting of a varying number of small circles and increases the number of small circles as the radii of the rings grow in such a way that the distribution of the small circles is eventually relatively even. The radii of the small circles are calculated using a sine-wave function that commutes between a radius of zero and 0.5 mm. The sine wave also gets a shift for each of the rings in order to produce the spiral effect.

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}

\foreach \stepy in {10, ..., 30}
\pgfmathsetmacro\stepstart{60/\stepy}
\pgfmathsetmacro\steplast{360-\stepstart}
\pgfmathsetmacro\stepcount{floor(360/\stepstart)}
\foreach \stepx in {0, \stepstart, ..., \steplast}
\pgfmathsetmacro\stepsingle{floor(\stepx/\stepstart)}
\fill[green] (\stepx:\stepy mm) circle (\stepradius mm);

\end{tikzpicture}

\end{document}


Edited to give it a more of a 3D effect:

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}

\foreach \stepy in {10, ..., 30}
\pgfmathsetmacro\stepstart{60/\stepy}
\pgfmathsetmacro\steplast{360-\stepstart}
\pgfmathsetmacro\stepcount{floor(360/\stepstart)}
\foreach \stepx in {0, \stepstart, ..., \steplast}
\pgfmathsetmacro\stepsingle{floor(\stepx/\stepstart)}
\fill[green] ({\stepx+.25*\stepcount}:\stepy mm) circle (\stepradius mm);

\end{tikzpicture}

\end{document}


In the original picture, the inner circles are smaller and closer together. I guess, it is not too difficult to achieve this effect.

• Jasper Habicht, thanks a lot for your solution. it is almost perfect for me. How can I make the inner radius smaller? Feb 22, 2021 at 20:02
• You can change \foreach \stepy in {10, ..., 30} to \foreach \stepy in {5, ..., 30}, that is, decrease the first number or increase the last one. The more steps (or circles) there are, the longer it will take to compile though. Feb 22, 2021 at 20:04
• Very nice. Excellent. +1 Feb 22, 2021 at 21:08

Here is a brief example that will probably require several adjustments. I add a commented spiral that I use as a reference.

\documentclass[tikz, border=2mm]{standalone}

\begin{document}
\begin{tikzpicture}[line cap=round]
\foreach\a in {0,2,...,359}       % angle to put each cricle (polar coordinates)
{
\pgfmathsetmacro\s{2.5+\a/90}   % theoretical point of the spiral (radius, polar coordinates)
\foreach\r in {2.5,2.6,...,6.5} % radius to put each circle (polar coordinates)
{
\pgfmathsetmacro\w{0.1+0.5/(1+abs(\s-\r))} % width of the circles
\fill[green] (\a:\r) circle (\w mm);
}
% Reference spiral:
%\fill (\a:\s) circle (0.05);
}
\end{tikzpicture}
\end{document}