The NY Times Code
Today I am releasing the Processing code that I used for this map and these graphs, and the code that I used to get the data from the NY Times. To run the programs, (download Processing, then) unzip the programs and place them in your sketchbook folder.
The code used to gather data from the Times’ API can be found here. Jer has a great introduction to working with the Times’ API in Processing that is worth reading. In order to use my code (or Jer’s), you need to make an account with the NY Times and request an API key. This is painless and you can do it at developer.nytimes.com.
The code for the map program can be downloaded here. For this program I used an .svg map of Africa that I found on this wikipedia page. Wikipedia has lots of other .svg maps that you can use.
The code for the graphs is here. The bulk of this code comes from Ben Fry’s book Visualizing Data.* I lightly edited the code, wrapped it in loops, and made some changes to make it read my input and output image files.
If you need a general introduction to Processing the tutorials and reference sections of the Processing webpage are great, as is Casey Reas’ book Processing. Casey Reas and Ben Fry are the founders of Processing and I found both of their books very helpful.
All of the above code (except for the excerpts from Ben Fry’s book or Jer’s webpage) was written by a complete amateur and probably has lots of problems. My goal at the beginning of this project was to learn how to use Processing just well enough to solve my problems in the fastest amount of time possible. If that philosophy doesn’t appeal to you, then my code probably won’t either.
*Today I started using Amazon Affiliate links on books and media that I really like. I am hoping that this can help me buy more books that I really like. It also introduces a conflict of interest, so I felt that I should disclose it publicly.
Notes
-
markoferko reblogged this from ryanbriggs and added:
digitális archívum buzikáim, nem
-
ryanbriggs posted this