Basis: Plotting arbitrary coordinate systems in Ruby-Processing

One of the first things I realised while working on visualisations in Processing is that a lot of the work required in setting up coordinate systems and plotting them is somewhat of a chore. Specifically, for things like parallel coordinates, multiple axes, each with its own scaling, I initially ended up with some pretty ugly custom code for each case. I did look around in the Libraries section of the Processing website, but didn’t find anything specific to manipulating and plotting coordinate axes.

So I wrote Basis. Basis essentially lets you create and plot arbitrary 2D coordinate axes by specifying the basis vectors of the coordinate system. These basis vectors need not be linearly independent, a happy side-effect of making the basis specification as simple as possible. There’s still a ton of work which needs to be done to make using it a little more pleasant, but you can give it a poke if you like. I’ve extracted out the Basis gem into its own GitHub project, but will be posting samples of its use soon.
Here’s an example of a Basis plot, using standard rectilinear coordinates, the basis vectors being [1,0] and [0,1].

And here’s the same data, but plotted using basis vectors [1,1] and [-1,1].

And while we’re at it, here’s a quick look at an arbitrary basis [1,0] and [0.3,1].

You can get the source and/or the gem here. There’s still more work I’ve planned for this, so expect (breaking) changes, but feel free to test it out.