In the last six years I’ve written numerous Python scripts to generate graphics. By using algorithms that incorporate both repetition and randomness, I can produce images that would be infeasible or at least time-consuming to draw by hand.

stylized histological pattern

I recently compiled these scripts into a Python package called algoraphics to facilitate the creation of images like these. Its first main feature is the representation of vector graphics as nested lists of dictionaries, which can be assembled and modified in intuitive Pythonic ways. They can then be converted into an SVG file and rendered to PNG.

Its second main feature is the incorporation of abstract graphic parameter objects. Parameters like lengths, positions, and colors can be specified as distributions. This can be used to build strikingly different patterns from the same basic commands, or to add subtle randomness to an otherwise rigid pattern. These distributions can even be specified with randomized hyperparameters, allowing for continuity across consecutively generated objects:

series of lines showing parameter behaviors

Many more examples are shown in the user guide.

My main motivation was to capture the interplay between order and chaos that is seen in nature. This natural quality makes the graphics more pleasing to the eye.

round branching plant

There is still much to improve, but I hope some find it useful!