Loading design...

A beautiful sunflower phyllotaxis pattern created with Python Turtle. Read the code below, copy it, and try it in your own Python environment.
from turtle import *
import math
import colorsys
bgcolor("black")
title("Phyllotaxis Pattern")
tracer(50)
hideturtle()
speed(0)
penup()
num_dots = 900
dot_size = 6
golden_angle = math.radians(137.5077640500378)
for i in range(num_dots):
hue = i / num_dots
rgb = colorsys.hsv_to_rgb(hue, 1, 1)
color(rgb)
theta = i * golden_angle
radius = 7 * math.sqrt(i)
x = radius * math.cos(theta)
y = radius * math.sin(theta)
goto(x, y)
dot(dot_size)
update()
mainloop()