Skip to content

Instantly share code, notes, and snippets.

@geoffalday
Created June 15, 2012 15:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffalday/2937231 to your computer and use it in GitHub Desktop.
Save geoffalday/2937231 to your computer and use it in GitHub Desktop.
Displays hottest days using R
# Nashville's hottest days in 2011
weather2011 <- read.csv('wunder-data-2011.txt', sep=',', header=TRUE)
fill_colors <- c()
for (i in 1:length(weather2011$tmax)) {
if (weather2011$tmax[i] > 80) {
fill_colors <- c(fill_colors, '#CC0000')
} else {
fill_colors <- c(fill_colors, '#CCCCCC')
}
}
barplot(weather2011$tmax, names.arg=weather2011$timestamp, col=fill_colors, border=NA, xlab="Day", ylab="Max Temp", main="Nashville's hottest days in 2011")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment