PlotDevice
A Python-based graphics language for
designers, developers, and tinkerers
PlotDevice is a Macintosh application that lets you write Python scripts to generate
2D graphics using simple drawing commands.
Under the hood, your code drives the system's Quartz
imaging engine, giving your scripts the same graphical power as a full-fledged Cocoa app.
Your code can combine basic geometric shapes, typography,
freeform Bézier curves, and a panoply of
image formats. This omnivorousness makes PlotDevice ideal for
both workaday tasks like image-processing as well as more exotic
uses ranging from procedural
texture generation to data visualization.
PlotDevice is more than just an updated version of Logo. The graphics you create in the
app can be exported to a variety of popular file-types.
In fact, without changing a single line of code, a script can generate bitmaps
(PNG, JPEG, HEIC, or TIFF) or scalable vector images (PDF or EPS). Whether you're
designing for print or screen, PlotDevice speaks your language.
In addition to static images, your scripts can easily generate multi-frame animations. Movies can be exported as H.265-encoded QuickTimes, animated GIFs, and even PDF ‘flipbooks’.
PlotDevice lets you focus on the design first and only worry about the production details
as necessary.
The application gives you everything you need to start writing programs that draw to a virtual canvas. It features a text editor with syntax highlighting and tab completion plus
a zoomable graphics viewer and a variety of export options.
PlotDevice's simple but comprehensive set of graphics commands will be familiar to users
of similar graphics tools like NodeBox or Processing. And if you're new to programming,
you'll find there's nothing better than being able to see the results of your
code as you learn to think like a computer.
The scripts you write in PlotDevice are useful even outside of the app. You can use the included command line tool to run scripts and export images from the Terminal. The graphics routines can be imported from your own external Python scripts using the PlotDevice module, leaving your code in the driver's seat.
PlotDevice also provides a form of graphics sneakernet using the clipboard. Within the app you can copy the graphical output as a PDF and paste it into the illustration program of your choice. This allows for semi-automated designs combining code-driven structure and handmade detailing.
The PlotDevice Reference describes the ins and outs of the drawing commands and datatypes available to your scripts. The entries discuss each command's syntax and demonstrate their use.
Those looking for a more narrative walk through the API will want to dive into
the
Tutorial – a short book describing the PlotDevice
drawing model and how to use it efficiently and expressively.
Perhaps the best way to learn a new language is to look at sample code. The app comes with a slew of terrific scripts written by Tom De Smedt which are accessible from the “Examples” menu.
The application requires a Macintosh running macOS 11 or newer. After downloading the archive, place the app in your “Applications” folder.
If you're on-the-go and would like a copy of the User Manual that doesn't require net connectivity, download this archive for a static version of the full docs.
The examples included with the app can also be downloaded separately and run using the module’s plotdevice
command line tool.
PlotDevice is an ongoing work-in-progress and your help is appreciated. If you'd like to get involved, report a bug or (better still) send a pull request.
You don't need to work within the app to use its graphics capabilities. Install the module and import it from your scripts for the best of both worlds.
PlotDevice is open source and we hope you'll make the most of it. Feel free to use it however you like, but please consider sharing your modifications.
This project is a fork of the NodeBox 1 application which was developed in the early oughts at the Experimental Media Research Group in Antwerp and derived from an early version of DrawBot. Its original goals were twofold: offering a powerful graphics tool for Pythonistas and providing a learning environment for budding programmers.
PlotDevice is an “existential refactor” of the NodeBox code, updating it to work with modern versions
of Python and macOS and adding syntactic sugar as judiciously as possible. Its main code-level innovation
is the use of the Python with
statement to
reversibly modify graphics state. Despite these changes, it maintains backward compatibility with all the original NodeBox commands.
PlotDevice is primarily the work of Christian Swinehart, with significant API-design contributions from Marcos Ojeda. Special thanks to Alexander Bohn, Anselm Levskaya, and Adam Suharja for beta testing and essential feedback. Authors of the earlier projects in the app's lineage include:
PlotDevice is hardly the only app of its kind. It differs from similar projects in its focus on automation, expressiveness, and export quality over rendering speed or interactivity. If these trade-offs don’t match your project's use case, you still have a number of terrific packages to choose from:
The original inspiration for this project, NodeBox has gone in an interesting, Max/MSP-like direction in recent years and is now growing toward a web based future incarnation.
A cross-platform implementation of the NodeBox API. Rendering is offloaded to the GPU for high-performance interactive graphics.
NodeBox was originally a fork of this app which
is currently enjoying a renaissance of active development. Its commands are similar to PlotDevice’s but hew closer to the underlying imaging model for a less “abstracted” experience.
Ben Fry & Casey Reas kicked off the current wave of programmatic-drawing environments with their release of Processing in 2001. In addition to being “the original”, it’s the most time-tested and has by far the largest community.