Ryan C Briggs
You are only looking at posts tagged processing.
01.02.2010

1988-89

1988-89

1998-99

1998-99

2008-09

2008-09

I wrote a little program to query the NY Times API and generate text output that can be easily copied into the advanced section of Wordle to create tag clouds of news coverage. The example above shows the most popular places in the Times, conditional on the description of the article being “US International Relations.” Each picture covers one year. The colour is currently meaningless.

You can download the code here.

19.06.2009

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.

10.06.2009

The (delayed) NY Times Code

A few people have asked me where they can find the processing code that I used in my recent visualizations. Right now it is messy and incomplete and sitting on my desktop. It will stay there until I can clean it up. I’m aiming to have the code ready for public consumption before I travel to Chicago on June 18th.

Also, I am flattered by the positive response that the visualizations received. Thank you. It is really uplifting.

29.05.2009
Texas in Africa recently asked:
If you took all the stories about African countries in American newspapers and removed those about poverty, disease, and war, I wonder what would be left?
I don’t have a perfect answer, but I can offer a tentative one. The New York Times tags all of its stories on a number of variables, including the article’s geographic subject and its relevant overarching themes. This information is free for people to play around with (do it). I modified one of the programs I used previously to find out what themes were prevalent when an article was about the continent of Africa. Two caveats:

These numbers are drawn from articles on the continent as a whole (as are the numbers for the graph above). Articles on specific countries or cities in Africa were not included unless wider Africa was an important part of the story.
Each article can be tagged as having more than one overarching theme. I wanted to show the data as a pie chart, but the non-exclusivity of the themes made that impossible.

With that out of the way, the juicy stuff:

16% of the articles on Africa in the New York Times between 1981 and 2008 were tagged as being about AIDS

12% were on foreign aid

5% were on famine

5% were on civil war and guerrilla warfare

4% were on immigration and refugees


Don’t add the the percentages up! Each bullet is true on its own but you can’t add the percentages and say that 42% were on stereotypical themes. There is likely overlap between the “immigration and refugees” category and the “civil war and guerilla warfare” category, for example. There were some more nebulous categories as well:

21% were on US International Relations or International Relations

11% were on economic conditions and trends

6% were tagged as being on third world and developing countries


As you can probably gather by now, the labeling system that the Times uses is a little opaque and can be hard to follow. I would not rely heavily on these numbers (only 6% were on developing countries?), but they do provide some insight into how Africa is portrayed in one major newspaper. Texas in Africa, that is the best I can do right now.

Texas in Africa recently asked:

If you took all the stories about African countries in American newspapers and removed those about poverty, disease, and war, I wonder what would be left?

I don’t have a perfect answer, but I can offer a tentative one. The New York Times tags all of its stories on a number of variables, including the article’s geographic subject and its relevant overarching themes. This information is free for people to play around with (do it). I modified one of the programs I used previously to find out what themes were prevalent when an article was about the continent of Africa. Two caveats:

  1. These numbers are drawn from articles on the continent as a whole (as are the numbers for the graph above). Articles on specific countries or cities in Africa were not included unless wider Africa was an important part of the story.
  2. Each article can be tagged as having more than one overarching theme. I wanted to show the data as a pie chart, but the non-exclusivity of the themes made that impossible.

With that out of the way, the juicy stuff:

  • 16% of the articles on Africa in the New York Times between 1981 and 2008 were tagged as being about AIDS
  • 12% were on foreign aid
  • 5% were on famine
  • 5% were on civil war and guerrilla warfare
  • 4% were on immigration and refugees

Don’t add the the percentages up! Each bullet is true on its own but you can’t add the percentages and say that 42% were on stereotypical themes. There is likely overlap between the “immigration and refugees” category and the “civil war and guerilla warfare” category, for example. There were some more nebulous categories as well:

  • 21% were on US International Relations or International Relations
  • 11% were on economic conditions and trends
  • 6% were tagged as being on third world and developing countries

As you can probably gather by now, the labeling system that the Times uses is a little opaque and can be hard to follow. I would not rely heavily on these numbers (only 6% were on developing countries?), but they do provide some insight into how Africa is portrayed in one major newspaper. Texas in Africa, that is the best I can do right now.

28.05.2009
The picture above shows the New York Times coverage of nine African countries from 1981 to 2008. You can click for a larger image. If you want to download the entire set of (much better quality) images, you can get them here. The set contains 48 pictures (continental Africa plus Madagascar) and a text file with some extra information and caveats.
I would love feedback, but I am not a fan of blog comments. You can reach me on twitter at @ryanbriggs.
—UPDATE: May 28, 2009 —
Andrew Hughey pointed out that I was missing some articles on the DRC because I forgot to includes those titled Zaire. The image for the DRC is now updated to reflect the additional articles, as is the map.

The picture above shows the New York Times coverage of nine African countries from 1981 to 2008. You can click for a larger image. If you want to download the entire set of (much better quality) images, you can get them here. The set contains 48 pictures (continental Africa plus Madagascar) and a text file with some extra information and caveats.

I would love feedback, but I am not a fan of blog comments. You can reach me on twitter at @ryanbriggs.

—UPDATE: May 28, 2009 —

Andrew Hughey pointed out that I was missing some articles on the DRC because I forgot to includes those titled Zaire. The image for the DRC is now updated to reflect the additional articles, as is the map.

12.05.2009
The New York Times’ API is really fantastic.
— Update: May 28, 2009 —
A point of comparison (requested by @theresac) is that in the same time period Canada had 10905 articles, Mexico had 10042, Germany had 10161, Norway had 1393, and Bangladesh had 900. I will soon upload the graphs of each country in Africa over time, as they show where coverage spiked. The point of the original exercise was to allow for comparisons within the continent (and to learn how to use processing), but if I find some extra time over the summer I might expand the project to the rest of the world.
— Update #2: May 28, 2009 —
Andrew Hughey pointed out that I was missing some articles from the DRC because I forgot to includes those titled Zaire. The map is now updated to reflect the additional articles.

The New York Times’ API is really fantastic.

— Update: May 28, 2009 —

A point of comparison (requested by @theresac) is that in the same time period Canada had 10905 articles, Mexico had 10042, Germany had 10161, Norway had 1393, and Bangladesh had 900. I will soon upload the graphs of each country in Africa over time, as they show where coverage spiked. The point of the original exercise was to allow for comparisons within the continent (and to learn how to use processing), but if I find some extra time over the summer I might expand the project to the rest of the world.

— Update #2: May 28, 2009 —

Andrew Hughey pointed out that I was missing some articles from the DRC because I forgot to includes those titled Zaire. The map is now updated to reflect the additional articles.

6.15.pm
I have been playing around with the New York Times API and Processing over the last few days for a project I am working on. I am looking at how the Times’ coverage of Africa has shifted from 1981 (the earliest date accessible by the API) to 2008. The picture above shows the (predictable) spike in the number of New York Times articles about Rwanda in 1994.
Expect more visualizations of Times data over the next few weeks as I wrap up the project. I didn’t find anything earth shattering, but having data to back up hunches is always nice. If anyone wants to learn how to use processing I can’t recommend Processing and Visualizing Data enough. Both were written by the people who created the Processing language. The picture that I made above draws heavily on code written by Ben (one of the creators) in an example in his book.
When everything is finished I will post the code and the final visualizations to this page.
A final note: if you are interested in the link between media attention and violence, you should check out this recent post from Alex de Walle on the SSRC webpage.

I have been playing around with the New York Times API and Processing over the last few days for a project I am working on. I am looking at how the Times’ coverage of Africa has shifted from 1981 (the earliest date accessible by the API) to 2008. The picture above shows the (predictable) spike in the number of New York Times articles about Rwanda in 1994.

Expect more visualizations of Times data over the next few weeks as I wrap up the project. I didn’t find anything earth shattering, but having data to back up hunches is always nice. If anyone wants to learn how to use processing I can’t recommend Processing and Visualizing Data enough. Both were written by the people who created the Processing language. The picture that I made above draws heavily on code written by Ben (one of the creators) in an example in his book.

When everything is finished I will post the code and the final visualizations to this page.

A final note: if you are interested in the link between media attention and violence, you should check out this recent post from Alex de Walle on the SSRC webpage.

← older posts