Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. library(ggplot2)
  2.  
  3. # deviation_potsdam.csv has been created using crash:
  4. # 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
  5. frame <- read.table('deviation_potsam.csv', header=TRUE, sep=",")
  6. negative <- frame$deviation < 0
  7. # create the png
  8. png("deviation_potsdam.png", width=900, height=480)
  9. print(
  10. ggplot(
  11. frame,
  12. aes(x=frame$year, y=frame$deviation, fill=negative)
  13. ) + geom_bar(stat="identity") + labs(x="Year", y="Deviation") + guides(fill=FALSE) + scale_x_continuous(breaks=seq(1890, 2015, by=5)))
  14. dev.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement