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.

example 1

example 2

example 3

example 4

example 5

example 6

example 7

example 8

example 9

example 10

example 11

example 12

example 13

example 14

example 15

example 16

example 17

example 18

example 19

example 20

example 21

example 22

example 23

example 24

example 25

example 26

example 27

More

See

Next

Related