Created
March 12, 2011 23:14
-
-
Save mjbommar/867670 to your computer and use it in GitHub Desktop.
Plot the #march11/#saudi tweets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#@author Michael J Bommarito II | |
#@date Mar 12, 2011 | |
# Thanks Hadley! | |
library(ggplot2) | |
# Load the sample | |
twitterDF <- read.csv('sample.csv', header=FALSE, stringsAsFactors=FALSE) | |
# Convert Twitter dates to POSIXct objects | |
twitterDF$date <- as.POSIXct(strptime(twitterDF$V4, "%a, %d %b %Y %H:%M:%S %z", tz = "GMT")) | |
# Plot the frequency at 10 minute interval | |
binSize <- 10 | |
ggplot(data=twitterDF, aes(x=date)) + | |
geom_bar(aes(fill=..count..), alpha=0.5, binwidth=60*binSize) + | |
scale_x_datetime("Date") + | |
scale_y_continuous("Frequency") + | |
opts(title="#march11/#saudi Tweet Frequency", legend.position='none') | |
ggsave(file='march11_tweets.pdf', width=8, height=6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment