| Gabriel |
Now that I’ve gotten R and
igraph to make a set of 53 png files (see yesterday’s post), the next step is animating them. I did this using the command line tool ImageMagick, which I installed using Fink, the (buggy) Mac version of the Debian package manager. Once ImageMagick is installed, I can do everything from directly within R using
system(). To accomplish this, I just added these lines of code to the end of yesterday’s script. The “mv” commands are necessary because ImageMagick has a naive view of alphabetical order.
#create animated gif in image magick setwd("~/Documents/book/images/") system("mv chrnet_hc0.png chrnet_hc00.png") system("mv chrnet_hc1.png chrnet_hc01.png") system("mv chrnet_hc2.png chrnet_hc02.png") system("mv chrnet_hc3.png chrnet_hc03.png") system("mv chrnet_hc4.png chrnet_hc04.png") system("mv chrnet_hc5.png chrnet_hc05.png") system("mv chrnet_hc6.png chrnet_hc06.png") system("mv chrnet_hc7.png chrnet_hc07.png") system("mv chrnet_hc8.png chrnet_hc08.png") system("mv chrnet_hc9.png chrnet_hc09.png") system("convert *.png chrnet_humps.gif")
Here are the results. Vertices are stations, which turn black when the station has begun playing “My Humps” by Black Eyed Peas. Yellow vertices have missing data on airplay (true missing data, not just right-censored). The graph layout is based on directed nominations from a survey so vertices near each other have low path length, but I hid the actual edges to preserve some privacy about the stations social network ties. My substantive interpretation of this animation (and a comparable event history) is that the network doesn’t really matter and the endogenous cascade is based on attention to aggregate peer behavior rather than that of specific alters.
Note that you may have to click on the image to see the animation.