Skip to content

Instantly share code, notes, and snippets.

@louisguitton
Created March 1, 2019 07:34
Show Gist options
  • Save louisguitton/3944d5cc1c8993b4402a737db4f17816 to your computer and use it in GitHub Desktop.
Save louisguitton/3944d5cc1c8993b4402a737db4f17816 to your computer and use it in GitHub Desktop.
Sunflower patterns are obtained using a Fermat spiral with a golden angle spacing
import numpy as np
from matplotlib import pyplot as plt
%matplotlib inline
n = range(1, 100)
phi = (3 - np.sqrt(5)) * np.pi
for a in [0.98, 0.985, 0.99, 0.995, 1, 1.005, 1.01, 1.015, 1.02]:
fig = plt.figure()
r = np.sqrt(n)
theta = a * phi * n
ax = fig.add_subplot(1, 1, 1, projection='polar')
c = ax.scatter(theta, r, alpha=0.75)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment