Martin Kavalar / Feb 26 2020
SVGWrite Environment
This notebook creates a reusable environment with SVGWrite.
pip install svgwrite4.8s
SVGWrite (Bash)
import mathimport randomimport svgwritedots, c, size, w, h = 3000, 6.1, 4, 670, 150phi = (1 + math.sqrt(5)) / 2rad_phi = (math.pi * 2) / (phi + 1)dwg = svgwrite.Drawing("/results/spiral.svg", (w, h))a = 0for n in range (0, dots): r = c * math.sqrt(n) x = r * math.cos (a) + w / 2 y = r * math.sin (a) + h / 2 color = "#%06x" % random.randint(0, 0xFFFFFF) dwg.add(dwg.circle ((x, y), size, fill=color)) a += rad_phidwg.save()0.9s
Python
SVGWrite