« Processing and NodeBox | Main | Growth, Creativity and Failure is OK »

First Visualizing Data Nodebox Conversions

I spent some time this evening with Nodebox and "Visualizing Data" by Ben Fry. I did encounter a couple of quirks and a few things i needed to re-implement in python, but i managed to get through the first couple of example applications in the book. Basically, i can load the map graphic, load the center point and the random data tab-delimited text files and plot circles on the center points of the map.

Nodebox Map Example Output

I had to reimplement a few things:

  • the Table class from the book was ported (mostly) to python. The API is a bit simpler since python is more flexible with types.
  • i built a processing module in python with the following methods:
  • processing.lerp - linear interpolation between two values
  • processing.norm - figures out the relative position of a value in a range (ie, norm(2, 0.0, 4.0) is 0.5
  • processing.map - Takes a value between 1 range of values and maps it to the equivalent spot in another range. This method is poorly named since python has a map method that does what a programming language should do for map().

The processing module will hold most of the stuff i needed to reimplement from processing.

I have posted the Nodebox Project and required libraries for you to download and play with. I should probably clarify the license on this code and put it in version control, but that is a task for another time.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)