About

What is it?

import spyrograph

spyrograph is a lightweight Python package that provides an expressive and flexible set of tools for drawing beautiful mathematically driven art

pip3 install spyrograph Official GitHub repo

Sample hypotrochoid drawing showing a circle rolling around the interior of another circle drawing a geometric shape

Key Features

  • Expressive and consistent syntax
  • Robust underlying mathematics
  • Clear visualizations and animations
  • Flexible to a wide range of usecases
  • Lightweight, just plug and play

Quickstart

spyrograph is designed to be expressive and easy-to-use - simply import spyrograph and jump right into drawing elegant, complex shapes in just a few lines of code!

from spyrograph import Hypotrochoid

# Trace a hypotrochoid from 0 to 2pi where
# the fixed circle radius is 300, rolling circle
# radius is 200, and the distance from the rolling
# circle is 100
hypotrochoid = Hypotrochoid(
    R=300,
    r=200,
    d=100,
    thetas=np.arange(0, 2*np.pi, .1)
)
hypotrochoid.trace(
    show_circles=True,
    frame_pause=.05,
    circle_color="grey"
)

The philosophy

import this

spyrograph was designed with The Zen of Python at its heart. Every design choice is carefully considered to make drawing and analyzing beautiful geometries as smooth as possible. The syntax is expressive and concise, allowing for beautiful and explicit code that is clean and immediately obvious. There should never be a moment where you’re questioning why the API does what it does; it is fluid and intuitive, designed for you the developer.

About the author

from chris_greening import bio

Chris Greening is a software engineer from the New York metropolitan area with a wide range of engineering experience - he is especially fond of Python and R

"Buy Me A Coffee"