Fast R code for plotting Clifford Attractors
Pretty aren’t they?
I’ve produced some R code to rapidly generate beautiful high resolution Clifford attractors.
The points of a Clifford attractor are defined by
$$
\begin{align}
x_{n+1} &= \sin(a y_n) + c \cos(a x_n) \\\
y_{n+1} &= \sin(b x_n) + d \cos(b y_n)
\end{align}
$$
where a, b, c, d are constants.
The standard R plot()
function is far too slow to plot millions of points with transparency. My code leverages the excellent scattermore
package which is over an order of magnitude faster.
Samples
A large gallery of high resolution Clifford Attractors can be found here. Some low resolution examples can be found below.
In these plots, the colour is based on the angle between the current and previous point. The a, b, c, d parameters are randomly drawn from a U(-3, 3) distribution.
More
See