Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Disney Marathon Weather in ggplot2
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
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)
@jbryer

This comment has been minimized.

Copy link
Owner Author

commented Oct 2, 2018

Here is the resulting plot:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.