Last active
October 2, 2018 17:36
-
-
Save jbryer/245518e632514d71951a6fe13824221b to your computer and use it in GitHub Desktop.
Disney Marathon Weather in ggplot2
This file contains 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
Year | Low | High | StartTemp | StartHumidity | Sky | Wind | |
---|---|---|---|---|---|---|---|
2018 | 41 | 61 | 41 | 82 | Clear | 5 | |
2017 | 34 | 52 | 34 | 79 | Clear | 13 | |
2016 | 55 | 71 | 71 | 90 | Overcast | 8 | |
2015 | 54 | 79 | 54 | 90 | Clear | 4 | |
2014 | 51 | 66 | 63 | 93 | Partly Cloudy | 8 | |
2013 | 60 | 81 | 61 | 94 | Partly Cloudy | 0 | |
2012 | 50 | 77 | 50 | 96 | Clear | 0 | |
2011 | 43 | 64 | 44 | 68 | Clear | 5 | |
2010 | 28 | 44 | 29 | 55 | Clear | 9 | |
2009 | 55 | 79 | 56 | 97 | Clear | 4 |
This file contains 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
library(ggplot2) | |
library(reshape2) | |
weather <- read.csv('DisneyMarathonWeather.csv') | |
weather.melt <- melt(weather[,c('Year', 'Low', 'High', 'Wind', 'StartHumidity', 'Sky')], | |
id.vars = c('Year', 'Wind', 'StartHumidity', 'Sky')) | |
ggplot(weather.melt, aes(x = Year)) + | |
geom_ribbon(data = weather, aes(ymin = Low, ymax = High), alpha = 0.3, fill = 'skyblue') + | |
geom_path(aes(y = value, group = variable)) + | |
geom_point(aes(y = value, size = Wind, color = Sky)) + | |
geom_text(aes(y = value, label = paste0(value, '°')), vjust = -1) + | |
scale_x_continuous(breaks = unique(weather.melt$Year)) + | |
scale_size_continuous('Wind (mph)') + | |
ylim(c(25, 85)) + | |
ylab('Temperature (Fahrenheit)') + xlab('') + theme_minimal() + | |
ggtitle('Disney Marathon Weather') | |
ggsave('DisneyMarathonWeather.png', width = 10, height = 4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is the resulting plot: