Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 14:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
simple bar graph
# deviation_potsdam.csv has been created using crash:
# bin/crash --format=csv -c "SELECT format('%tY', date) AS year, AVG(temp) - 8.659611756762368 as deviation FROM german_climate_denormalized WHERE temp IS NOT NULL AND station_name = 'Potsdam' and date < '2015-01-01' GROUP BY 1 ORDER BY 1 ASC" > deviation_potsdam.csv
frame <- read.table('deviation_potsam.csv', header=TRUE, sep=",")
negative <- frame$deviation < 0
# create the png
png("deviation_potsdam.png", width=900, height=480)
aes(x=frame$year, y=frame$deviation, fill=negative)
) + geom_bar(stat="identity") + labs(x="Year", y="Deviation") + guides(fill=FALSE) + scale_x_continuous(breaks=seq(1890, 2015, by=5)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment